#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long a[500000];
  for (int i = 1; i <= N; i++) cin >> a[i];
  sort(a + 1, a + N + 1);
  long long ops = 0;
  for (int i = 1; i <= N; i++) ops += abs(a[i] - i);
  cout << ops;
}
