Remove the current element from the hash map by decreasing the frequency to avoid counting when the number is a palindrome or when we visit its reverse
if ( freq . ContainsKey ( arr [ i ] ) ) { freq [ arr [ i ] ] -- ; } else { freq . Add ( arr [ i ] , - 1 ) ; }