Persons with at least x common surnames in pedigree

Hello, I have a database with persons who are connected to surname nodes from their pedigree.
Now I would like a query that only gives me the people and last names where the people have a minimum number of common last names.
I have tried many variants with count(), but I just don't get the desired result.
Can someone help me please?