Store the frequency of the four cells
if ( mp . ContainsKey ( mat [ i , M - 1 - j ] ) ) { mp [ mat [ i , M - 1 - j ] ] = mp [ mat [ i , M - 1 - j ] ] + 1 ; } else { mp . Add ( mat [ i , M - 1 - j ] , 1 ) ; } if ( mp . ContainsKey ( mat [ i , j ] ) ) { mp [ mat [ i , j ] ] = mp [ mat [ i , j ] ] + 1 ; } else { mp . Add ( mat [ i , j ] , 1 ) ; } if ( mp . ContainsKey ( mat [ N - 1 - i , M - 1 - j ] ) ) { mp [ mat [ N - 1 - i , M - 1 - j ] ] = mp [ mat [ N - 1 - i , M - 1 - j ] ] + 1 ; } else { mp . Add ( mat [ N - 1 - i , M - 1 - j ] , 1 ) ; } if ( mp . ContainsKey ( mat [ N - 1 - i , j ] ) ) { mp [ mat [ N - 1 - i , j ] ] = mp [ mat [ N - 1 - i , j ] ] + 1 ; } else { mp . Add ( mat [ N - 1 - i , j ] , 1 ) ; } x = 0 ;