During the Sui dynasty, a Law School, Arithmetics School, and Calligraphy School were put under the administration of the Guozijian. These schools accepted the relatives of officials rank eight and below while the Taixue, Guozijian, and Four Gates School served higher ranks. By the start of the Tang dynasty (618-907), 300 students were enrolled in the Guozijian, 500 at the Taixue, 1,300 at the Four Gates School, 50 at the Law School, and a mere 30 at the Calligraphy and Arithmetics Schools. Emperor Gaozong of Tang (r. 649-683), founded a second Guozijian in Luoyang. The average age of admission was 14 to 19 but 18 to 25 for the Law School. Students of these institutions who applied for the state examinations had their names transmitted to the Ministry of Rites, which was also responsible for their appointment to a government post.