#include <bits/stdc++.h>
using namespace std;
long long n, i, k, sol, a[300010];
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (i = 1; i <= n; i++) {
    k = a[i] - i;
    if (k < 0) k = -k;
    sol += k;
  }
  cout << sol << "\n";
  return 0;
}
