#include <bits/stdc++.h>
using namespace std;
long long n, a[300100];
int main() {
  cin >> n;
  for (int i = 0, _n = (int)(n); i < _n; i++) cin >> a[i];
  sort(a, a + n);
  long long second = 0;
  for (int i = 0, _n = (int)(n); i < _n; i++)
    second += max(i + 1 - a[i], a[i] - i - 1);
  cout << second;
  return 0;
}
