King Frederik IV of Denmark restructured his army in 1715–1718 in order to obtain a large but not too expensive army, because of the Great Nordic War which took place in 1700–1721. He designated 12 regions to provide cavalry, and one of them was Frederiksborg. Being a pietist, he also ordered each of these regions to build 20 schools each in very high quality for the education of the children in the regions, providing the first public schools in Denmark. This decision was made March 28, 1721, and all schools were established in 1727. One of these schools was built in Ølsted, and today this building is being used as an office for the local church. More information here.