The energy spectrum of ultra-high energy cosmic rays (UHECR) is usually calculated for sources with identical properties. Assuming that all sources can accelerate UHECR protons to the same extremely high maximal energy E_max > 10^{20} eV and have the steeply falling injection spectrum 1/E^{2.7}, one can reproduce the measured cosmic ray flux above E > 10^{18} eV. We show that relaxing the assumption of identical sources and using a power-law distribution of their maximal energy allows one to explain the observed UHECR spectrum with the injection 1/E^2 predicted by Fermi shock acceleration