Count of largest size group
int count = 0 ; foreach ( KeyValuePair < int , int > it in d ) { int k = it . Key ; int val = it . Value ; if ( val > size ) { size = val ; count = 1 ; } else if ( val == size ) count += 1 ; } return count ; }