fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_VALUE = 20;
  5.  
  6. int main() {
  7. int fr1[MAX_VALUE + 1] = {0};
  8. int flag1 = 1;
  9. int n;
  10. cin >> n;
  11. for (int i = 1; i <= n; ++i) {
  12. int currentElement;
  13. cin >> currentElement;
  14. if (i <= n / 2) {
  15. ++fr1[currentElement];
  16. if (fr1[currentElement] > 1) {
  17. flag1 = 0;
  18. }
  19. }
  20. }
  21. if (flag1 == 1) {
  22. cout << 1;
  23. } else {
  24. cout << 2;
  25. }
  26. return 0;
  27. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
1