Spectrum of antiprotons confined in the Earth's magnetosphere