Determination of the cross section of the pion and nucleon interaction with iron nuclei in the energy range 0.5–5.0 TeV