#include using namespace std; #ifdef LOCAL #include "debug.hpp" #else #define debug(...) 1 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = a[n - 1] - n; cout << ans << '\n'; }