Sequence of disorder-order and order-order transitions accompanying the formation of M2X superstructures