#include #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; int main() { int n, sum = 0; cin >> n; int a[n]; rep(i, n) cin >> a[i]; sort(a, a + n); rep(i, n) { sum += (i + 1) - a[i]; } cout << sum << endl; }