#include <bits/stdc++.h>
using namespace std;
long long count_primes(long long n) {
  const long long S = 10000;
  vector<long long> primes;
  long long nsqrt = sqrt(n);
  vector<char> is_prime(nsqrt + 1, true);
  for (long long i = 2; i <= nsqrt; i++) {
    if (is_prime[i]) {
      primes.push_back(i);
      for (long long j = i * i; j <= nsqrt; j += i) is_prime[j] = false;
    }
  }
  long long result = 0;
  vector<char> block(S);
  for (long long k = 0; k * S <= n; k++) {
    fill(block.begin(), block.end(), true);
    long long start = k * S;
    for (long long q = 0; q < primes.size(); q++) {
      long long p = primes[q];
      long long start_idx = (start + p - 1) / p;
      long long j = max(start_idx, p) * p - start;
      for (; j < S; j += p) block[j] = false;
    }
    if (k == 0) block[0] = block[1] = false;
    for (long long i = 0; i < S && start + i <= n; i++) {
      if (block[i]) result++;
    }
  }
  return result;
}
bool isprime(long long x) {
  long long i = 2;
  while (i * i <= x) {
    if (x % i == 0) return false;
  }
  return true;
}
long long A, B;
bool comp(pair<long long, long long> p1, pair<long long, long long> p2) {
  if (p1.first < p2.first) {
    return true;
  }
  return false;
}
long long prod(long long n) {
  long long mid = INT_MAX, mad = INT_MIN;
  while (n) {
    long long d = n % 10;
    mid = min(mid, d);
    mad = max(mad, d);
    n /= 10;
  }
  return mid * mad;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t, n, x, y;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  long long p = 0, ans = 0;
  for (long long i = 1; i < n + 1; i++) {
    ans += max(i - v[i - 1], v[i - 1] - i);
  }
  cout << ans << endl;
  return 0;
}
