aboutsummaryrefslogtreecommitdiff
path: root/cses/IntroductoryProblems/MissingNumber/main.cpp
blob: ec38059593b01bbe35fa99e7345319ade1d6599b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<bits/stdc++.h>

using namespace std;

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long sum = 0;
  for (int i = 0; i < n - 1; i++) {
    int x;
    cin >> x;
    sum += x;
  }
  long long x = n + 1;
  long long ans = ((n * x) / 2) - sum;
  cout << ans << endl;
}