Problem Link: Distinct Numbers
Approach
Put all values into a set and return its size.
Solution
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
set<int> s;
while (n--) { int x; cin >> x; s.insert(x); }
cout << s.size();
}