fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. int main()
  5. {
  6. int n;
  7. cin >> n;
  8. int arr[n];
  9. for (int i = 0; i < n; i++) cin >> arr[i];
  10. sort(arr, arr + n);
  11. int cnt = 1;
  12. for (int i = 0; i < n - 1; i++){
  13. if (arr[i] != arr[i + 1])
  14. cnt++;
  15. }
  16. cout << cnt << endl;
  17. }
  18.  
Success #stdin #stdout 0.01s 5220KB
stdin
Standard input is empty
stdout
251