It lies at the northeast corner of Aberdeenshire , around 40 m north of Aberdeen , and 17 m north of Peterhead . It lies at the extreme northeast corner of Aberdeenshire , around 40 m north of Aberdeen , and 17 m north of Peterhead .