Module to add a "linked resources" count as a new value

Is there such a thing as a module which can add up the number of “linked resources” for an item and then add that number as a new metadata value for the item? (And update that count as necessary as new items/links are added?)

In other words, if I had “Henry VIII” as an item, and then had a property called “Partners” where I could link him to each of his six wives (each one being a separate item), I would like to also have a property called “Number of Wives” which would equal 6. Is this something which is possible using an existing module?