Energy density of ionospheric and solar wind origin ions in the near-Earth magnetotail during substorms