Input (grade 11): David Cameron is a fourth great grandson of Elizabeth Hay, thus making him the fifth cousin, twice removed to Queen Elizabeth II according to Debrett's.
Output (grade 7): David Cameron is related to Elizabeth Hay through William IV, which makes him the fifth cousin, twice removed to the Queen.