Added function to calculate # of pairwise comparions