Store the coordinates along with their frequencies
for ( int i = 0 ; i < n ; i ++ ) { KeyValuePair < int , int > tmp = new KeyValuePair < int , int > ( x [ i ] , y [ i ] ) ; if ( m . ContainsKey ( tmp ) ) { m [ tmp ] ++ ; } else { m [ tmp ] = 1 ; } } foreach ( KeyValuePair < KeyValuePair < int , int > , int > i in m ) { Console . Write ( i . Key . Key + " ▁ " + i . Key . Value + " ▁ " + i . Value + " STRNEWLINE " ) ; } }