MohamedAbdel3al

1. Unique Elements

Sep 15th, 2021 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std ;
  4. #define sz(s) int(s.size())
  5. typedef long long ll ;
  6. #define all(v) v.begin() , v.end()
  7.  
  8. void ABDEL3AL () {
  9. ios_base::sync_with_stdio(false); cin.tie(nullptr) , cout.tie(nullptr) ;
  10. #ifndef ONLINE_JUDGE
  11. freopen("input.txt" , "r" , stdin) , freopen("output.txt" , "w" , stdout) ;
  12. #endif
  13. }
  14.  
  15. int main() {
  16. ABDEL3AL() ;
  17. int n , cnt = 0 ;
  18. cin >> n ;
  19. map <ll , int> mp ;
  20. while (n--) {
  21. ll x ; cin >> x ;
  22. mp[x]++ ;
  23. }
  24. for (int& i : mp)
  25. if (i.second == 1) cnt++ ;
  26. cout << cnt ;
  27. return 0;
  28. }
Add Comment
Please, Sign In to add comment