#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
const int MOD = 1e9 + 7;
const int inf = 2e9;
long long ans;
int n, ind;
int a[MAXN];
bool mark[MAXN];
vector<int> bad;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] >= 1 && a[i] <= n) {
      if (mark[a[i]]) bad.push_back(a[i]);
      mark[a[i]] = true;
    } else {
      bad.push_back(a[i]);
    }
  }
  sort(bad.begin(), bad.end());
  for (int i = 1; i <= n; i++) {
    if (!mark[i]) {
      ans += fabs(bad[ind++] - i);
    }
  }
  cout << ans;
}
