Sorting#2684

Sorting

1 second
64 megabytes
Medium

cards are numbered from to (1 \leq N \leq 32767). These cards have been shuffled and placed in a single row on the table from left to right. In one move, you can swap any two cards. Find the minimum number of moves needed to arrange the cards in ascending order by their numbers.

Input

A single line contains first the number , then distinct natural numbers, each not exceeding . These numbers are the labels of the cards as they currently lie on the table.

Output

Output a single number: the minimum number of moves required.

Examples

Example 1

Loading
Loading