Permutation *p* is an ordered set of integers *p*<sub class="lower-index">1</sub>,  *p*<sub class="lower-index">2</sub>,  ...,  *p*<sub class="lower-index">*n*</sub>, consisting of *n* distinct positive integers, each of them doesn't exceed *n*. We'll denote the *i*-th element of permutation *p* as *p*<sub class="lower-index">*i*</sub>. We'll call number *n* the size or the length of permutation *p*<sub class="lower-index">1</sub>,  *p*<sub class="lower-index">2</sub>,  ...,  *p*<sub class="lower-index">*n*</sub>.

You have a sequence of integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. 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.
The first line contains integer *n* (1 ≤ *n* ≤ 3·10<sup class="upper-index">5</sup>) — the size of the sought permutation. The second line contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> ( - 10<sup class="upper-index">9</sup> ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).
#include<bits/stdc++.h>
using namespace std;

#define endl "\n" 
#define lp(i, a, b) for (int i = a; i < b; i++)
#define lpp(i, a, b) for (int i = a; i <=b; i++)
#define print(arrrr) lp(i,0,n) cout << arrrr[i] << " "
#define scan(arrrr) lp(i,0,n) cin >> arrrr[i]
#define pi pair<int, int>
#define vs vector<string>
#define vi vector<int>
#define all(arr) arr.begin(), arr.end()
#define F first
#define S second
#define yes cout << "YES"<<"\n" ;
#define no cout << "NO"<<"\n" ;
#define ll long long int
#define int int64_t

void solve()
{
int n;cin>>n;
int arr[n],ar[n],cnt=0;scan(arr);
lp(i,0,n){
    ar[i]=i+1;
}
sort(arr,arr+n);
lp(i,0,n){
    cnt+=abs(arr[i]-ar[i]);
}
cout<<cnt<<endl;
}

int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t=1 ;
// cin >> t ; 
while(t--)
{
solve();
}

}
