#include <bits/stdc++.h>
using namespace std;
void printv(vector<long long int> v) {
  long long int sz = v.size();
  for (long long int i = 0; i < sz; i++) {
    if (i == sz - 1)
      cout << v[i] << "\n";
    else
      cout << v[i] << " ";
  }
}
void input(long long int a[], long long int sz) {
  for (long long int i = 0; i < sz; i++) cin >> a[i];
}
void print(long long int a[], long long int sz) {
  for (long long int i = 0; i < sz; i++) {
    if (i == sz - 1)
      cout << a[i] << "\n";
    else
      cout << a[i] << " ";
  }
}
long long int dx1[] = {1, 1, 0, -1, -1, -1, 0, 1};
long long int dy1[] = {0, 1, 1, 1, 0, -1, -1, -1};
long long int dx2[] = {1, 0, -1, 0};
long long int dy2[] = {0, 1, 0, -1};
long long int mul(long long int a, long long int b,
                  long long int p = 1000000007) {
  return ((a % p) * (b % p)) % p;
}
long long int add(long long int a, long long int b,
                  long long int p = 1000000007) {
  return (a % p + b % p) % p;
}
long long int power(long long int x, long long int y,
                    long long int p = 1000000007) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int modInverse(long long int n, long long int p = 1000000007) {
  return power(n, p - 2, p);
}
long long int ncrMod(long long int n, long long int r,
                     long long int p = 1000000007) {
  if (r == 0) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
bool isPrime(long long int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
bool cmp(pair<long long int, long long int>& a,
         pair<long long int, long long int>& b) {
  if (a.first == b.first) {
    return (a.second < b.second);
  } else {
    return (a.first > b.first);
  }
}
void solve() {
  long long int n;
  cin >> n;
  long long int a[n];
  input(a, n);
  sort(a, a + n);
  long long int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (i + 1 > a[i]) {
      cnt += (i + 1 - a[i]);
    } else {
      cnt += a[i] - (i + 1);
    }
  }
  cout << cnt << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}

### Prompt

Generate a Cpp solution to the following problem:

Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'll call number n the size or the length of permutation p1, p2, ..., pn.

You have a sequence of integers a1, a2, ..., an. In one move, you are allowed to decrease or increase any number by one. Count the minimum number of moves, needed to build a permutation from this sequence.

Input

The first line contains integer n (1 ≤ n ≤ 3·105) — the size of the sought permutation. The second line contains n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109).

Output

Print a single number — the minimum number of moves.

Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.

Examples

Input

2
3 0


Output

2


Input

3
-1 -1 2


Output

6

Note

In the first sample you should decrease the first number by one and then increase the second number by one. The resulting permutation is (2, 1).

In the second sample you need 6 moves to build permutation (1, 3, 2).

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void printv(vector<long long int> v) {
  long long int sz = v.size();
  for (long long int i = 0; i < sz; i++) {
    if (i == sz - 1)
      cout << v[i] << "\n";
    else
      cout << v[i] << " ";
  }
}
void input(long long int a[], long long int sz) {
  for (long long int i = 0; i < sz; i++) cin >> a[i];
}
void print(long long int a[], long long int sz) {
  for (long long int i = 0; i < sz; i++) {
    if (i == sz - 1)
      cout << a[i] << "\n";
    else
      cout << a[i] << " ";
  }
}
long long int dx1[] = {1, 1, 0, -1, -1, -1, 0, 1};
long long int dy1[] = {0, 1, 1, 1, 0, -1, -1, -1};
long long int dx2[] = {1, 0, -1, 0};
long long int dy2[] = {0, 1, 0, -1};
long long int mul(long long int a, long long int b,
                  long long int p = 1000000007) {
  return ((a % p) * (b % p)) % p;
}
long long int add(long long int a, long long int b,
                  long long int p = 1000000007) {
  return (a % p + b % p) % p;
}
long long int power(long long int x, long long int y,
                    long long int p = 1000000007) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int modInverse(long long int n, long long int p = 1000000007) {
  return power(n, p - 2, p);
}
long long int ncrMod(long long int n, long long int r,
                     long long int p = 1000000007) {
  if (r == 0) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
bool isPrime(long long int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
bool cmp(pair<long long int, long long int>& a,
         pair<long long int, long long int>& b) {
  if (a.first == b.first) {
    return (a.second < b.second);
  } else {
    return (a.first > b.first);
  }
}
void solve() {
  long long int n;
  cin >> n;
  long long int a[n];
  input(a, n);
  sort(a, a + n);
  long long int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (i + 1 > a[i]) {
      cnt += (i + 1 - a[i]);
    } else {
      cnt += a[i] - (i + 1);
    }
  }
  cout << cnt << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}

```