#include #include #include #include using namespace std; int main() { //int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0; long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0; //cout << LONG_MAX << endl; long x[100001]; //string s[1001]; cin >> a; for ( b = 0; b < a; b++) { cin >> x[b]; } sort(x, x + a); for ( b = 0; b < a; b++) { ans+=abs(b + 1 - x[b]); } cout << ans << endl; //cout << "aaaaaaa" << endl; return 0; }