Brane cosmology in an arbitrary number of dimensions