Codeforces Round 175 (Div. 2) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

greedy

implementation

sortings

*1200

No tag edit access

The problem statement has recently been changed. View the changes.

×
C. Building Permutation

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputPermutation *p* is an ordered set of integers *p*_{1}, *p*_{2}, ..., *p*_{n}, 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*_{i}. We'll call number *n* the size or the length of permutation *p*_{1}, *p*_{2}, ..., *p*_{n}.

You have a sequence of integers *a*_{1}, *a*_{2}, ..., *a*_{n}. 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·10^{5}) — the size of the sought permutation. The second line contains *n* integers *a*_{1}, *a*_{2}, ..., *a*_{n} ( - 10^{9} ≤ *a*_{i} ≤ 10^{9}).

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).

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/10/2023 07:17:49 (g2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|