#include <bits/stdc++.h>
using namespace std;
int p[300002], pi;
bool tag[300002];
int main() {
  int n, x;
  long long cnt;
  while (scanf("%d", &n) != EOF) {
    memset(tag, false, sizeof(tag));
    pi = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &x);
      if (x < 1 || x > n || tag[x])
        p[pi++] = x;
      else
        tag[x] = true;
    }
    sort(p, p + pi);
    cnt = 0;
    for (int i = 0, j = 1; i < pi; i++, j++) {
      while (tag[j]) j++;
      cnt += (long long)abs(p[i] - j);
    }
    printf("%I64d\n", cnt);
  }
  return 0;
}
