1320 - 玩筹码

通过次数

5

提交次数

6

Time Limit : 1 秒
Memory Limit : 128 MB

n 个筹码。第 i 个筹码的位置是 position[i]

我们需要把所有筹码移到同一个位置。在一步中,我们可以将第 i 个筹码的位置从 position[i] 改变为:

  • position[i] + 2position[i] - 2 ,此时 cost = 0

  • position[i] + 1position[i] - 1 ,此时 cost = 1

求将所有筹码移动到同一位置上所需要的 最小代价

Input

第一行为1个整数n,表示筹码个数

第二行为n个整数,表示筹码所在位置

Output

将所有筹码移动到同一位置上所需要的 最小代价

Examples

Input

3
1 2 3

Output

1

Input

5
2 2 2 3 3

Output

2

Input

2
1 1000000000

Output

1

Hint

1 <= position.length <= 100

1 <= position[i] <= 10^9