Jahn-Teller distortion and magnetic transitions in perovskiteRMnO3(R=Ho, Er, Tm, Yb, and Lu)