I heard a simlar one before, but it said 'king has four'.

Maybe sets of grandparents? Like a man has two, a king having one is actually a joke on incest in royal families. And beggar has none, cause he has no family to rely on .