the formation of gametes involves meiosis which is:
cell with two pairs of chromosomes (diploid cell)
each chromosome replicates itself
chromosomes part company and move to opposite poles
so divide for the first time
copies now separate and the second cell division takes place
4 haploid cells (gamete) each with half the number of chromosomes of the parent cell