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