#include <bits/stdc++.h>
using namespace std;
long i, k, pos[300009], n, v, t1;
map<long, long> p;
int main() {
  ios_base::sync_with_stdio(false);
  long long s = 0, d;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> v;
    if (v > 0 && p[v] == 0 && v <= n)
      p[v] = 1;
    else
      pos[t1++] = v;
  }
  sort(pos, pos + t1);
  int t = 1;
  for (i = 0; i < t1; i++) {
    for (k = t; k <= n; k++) {
      if (p[k] == 0) {
        if (pos[i] > k)
          d = pos[i] - k;
        else
          d = k - pos[i];
        s = s + d;
        t = k + 1;
        p[k] = 1;
        break;
      }
    }
  }
  cout << s << endl;
  return 0;
}
