Each person has their secrets. The Lady promised to reveal her New Ultra-Secret (NUS) to Cossack Mustache on his birthday, but she didn't keep her word. Instead, she devised a game for him.
There is a deck of cards, where each card with a denomination from to appears exactly twice. Cossack Mustache has moves. On each move, he can choose either the top card or the one immediately after it and draw it from the deck. If he draws two cards with the same denomination consecutively, he scores one point.
If Cossack Mustache scores the maximum possible number of points, the Lady might reveal the NUS to him. Help him by writing a program that determines the maximum number of points he can score.
The first line contains a single integer (1 \leq n \leq 100\ 000) — the maximum card denomination.
The second line contains integers a_1, a_2, ..., a_{2n} (1 \leq a_i \leq n) — the denomination of the i-th card from the top of the deck. It is guaranteed that each number from to appears exactly twice.
Output a single number — the maximum number of points that can be scored.
Example 1
Example 2
In the first example, the cards can be drawn in the following order: [1,\ 1,\ 2,\ 2,\ 3,\ 3].
In the second example, the cards can be drawn in the following order: [4,\ 2,\ 5,\ 6,\ 2,\ 7,\ 7,\ 1,\ 1,\ 4,\ 6,\ 3,\ 3,\ 5].