fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long iint;
  4.  
  5. int main() {
  6. iint n;
  7. cin >> n;
  8. iint sum = (n * (n-1)) / 2;
  9. while (n > 1) {
  10. iint a;
  11. cin >> a;
  12. sum -= a;
  13. n--;
  14. }
  15. cout << sum;
  16. }
Success #stdin #stdout 0.01s 5312KB
stdin
5
2 3 1 5
stdout
-1