Telling three from four neutrinos with cosmology