countLoops function

Count the number of loops in a pedigree tree.