Energy dependence of hadron yields in pp and AA collisions