fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin>>n;
  8. int a[n];
  9. for(int i=0;i<n;i++)
  10. {
  11. cin>>a[i];
  12. }
  13. int sum=0;
  14. for(int i=0;i<n;i++)
  15. {
  16. sum^=a[i];
  17. } cout<<sum;
  18. // your code goes here
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5556KB
stdin
5 
1 4 6 4 1
stdout
6