Magnetic phase transition of oxygen monolayers