请问为何统计不重复元素个数的时候,这样写就错了。
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int maxn = 2e5 + 5;
#define lowbit(x) (x)&(-x)


int a[maxn];
int main() {
	ios;
	int n;	cin >> n;    ll ans;
	for (int i = 0; i < n; ++i)	cin >> a[i];
	sort(a, a + n);
	//	int tot = unique(a, a + n) - a;
	int v1 = 0, v0 = 0x7fffffff;
	for (int i = 0; i < n; ++i) {
		v1 |= a[i];
		v0 &= a[i];
	}
	/*int tot = 0;
	for (int i = n - 1; i >= 0; --i)
		tot += (a[i] != a[i + 1]);*/
    int tot = unique(a, a + n) - a;    // 这里--------------为啥这么写错了
//	int k = lowbit(v1 ^ v0);
	for (int i = 0; i <= 30; ++i) {
		int cur = 1 << i;
		if (cur & (v1 ^ v0)) {
			ans = 1LL * cur * (tot - 1);    //这里------为何在这里输出ans就错了,放在最后才能ac
			break;
		}
	}
    cout << ans << endl;
}