#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long res = 0;
  cin >> n;
  vector<int> a;
  vector<int> f(n + 1, 0);
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a.push_back(t);
    if (t >= 1 && t <= n) f[t] += 1;
  }
  sort(a.begin(), a.end());
  int j = 0;
  for (int i = 1; i <= n; i++) {
    if (f[i] > 0) continue;
    while (a[j] >= 1 && a[j] <= n && j < n && f[a[j]] <= 1) j++;
    if (j >= n) break;
    if (a[j] >= 1 && a[j] <= n && f[a[j]] > 1) f[a[j]]--;
    res = res + (long long)abs(i - a[j]);
    f[i]++;
    j++;
  }
  cout << res;
}
