#include <bits/stdc++.h>
using namespace std;
void scanint(long long int &x);
map<long long int, long long int> vv;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  multiset<long long int> ms;
  long long int n;
  scanint(n);
  long long int a[n];
  long long int curr = 1;
  long long int i = 0;
  for (i = 0; i < n; i++) {
    scanint(a[i]);
    if (!vv[a[i]] && a[i] >= 1 && a[i] <= n)
      vv[a[i]]++;
    else
      ms.insert(a[i]);
  }
  long long int ans = 0;
  multiset<long long int>::iterator itr;
  for (itr = ms.begin(); itr != ms.end(); itr++) {
    while (vv[curr]) curr++;
    ans += abs(*itr - curr);
    vv[curr]++;
  }
  cout << ans << endl;
  return 0;
}
void scanint(long long int &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
