```
class Solution {
public:
int singleNumber(int A[], int n) {
unordered_map<int, int> number;
for(int i = 0; i < n; i++)
{
unordered_map<int, int>::const_iterator it = number.find(A[i]);
if(it == number.end())
{
number[A[i]] = 1;
}
else
number[A[i]] += 1;
}
for(unordered_map<int, int>::const_iterator it = number.begin(); it != number.end(); it++)
{
if(it->second != 3)
return it->first;
}
}
};
```