C++ 代码
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+1e4;
ll n,ans=1;
ll a[N];
signed main()
{
cin>>n;
for(ll i=1; i<=n; i++)cin>>a[i];
sort(a+1,a+n+1);
for(ll i=2; i<=n; i++)
if(a[i]!=a[i-1])
ans++;
cout<<ans;
return 0;
}