Polarization of vacuum by an external magnetic field in the (2+1)-dimensional quantum electrodynamics with a nonzero fermion density