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