The diploid number is restored when the two haploid cells combine to create a zygote. Basically when the sperm cell enters the egg cell and makes the offspring.
Oxygen and nitrogen are very electronegative than any other element in the periodic table hence they have more tendency to attract an electron towards itself