From gender segregation to gender equality in the school system