Influence of Structural Peculiarities on the Magnetic Order in the Three - Dimensional and Quasilayered Manganites of the Ruddlesden-Popper Series