#include #include #include #include #include #include using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) #define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++) #define in_arr(type, a, n) copy_n(istream_iterator(cin), n, (a).begin()); int main(){ int n; cin >> n; vector a(n); in_arr(int, a, n); sort(a.begin(), a.end()); int sum = 0; rep(i, n){ sum += abs(i + 1 - a[i]); } cout << sum << endl; return 0; }