```
class Solution {
public:
int singleNumber(int A[], int n) {
sort(A,A+n);
if(n==1) return A[0];
for(int i=0;i<n;i++){
if(A[i]!=A[++i]) return A[--i];
}
}
};
```

above is my code for single number, actually I am confused about why it was accepted. The complexity of Sort is O(N) ?