fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. vector<bool> a(202, false);
  7. int n, diffNum, curVal;
  8. cin >> n;
  9. diffNum = n;
  10. for(int i = 0; i < n; i++) {
  11. cin >> curVal;
  12. if(a[curVal + 100]) diffNum--;
  13. else a[curVal + 100] = true;
  14. }
  15. cout << diffNum << endl;
  16. }
Success #stdin #stdout 0s 4508KB
stdin
7
3 5 -7 7 5 -9 -4
stdout
6