#include using namespace std; int main(){ int n,in,ans=0; vector v; cin >> n; while(cin >> in) v.push_back(in); sort(v.begin(),v.end()); for(int i=0;ii+1)?v[i]-i-1:i+1-v[i]; cout << ans << endl; return 0; }