Kozak Vus and the Secret of the Lady
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 2n cards, where each card with a denomination from 1 to n appears exactly twice. Cossack Mustache has 2n 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.
Input Format
The first line contains a single integer n (1 ≤ n ≤ 100,000) — the maximum card denomination.
The second line contains 2n integers a[1]
, a[2]
, ..., a[2n]
(1 ≤ a[i]
≤ n) — the denomination of the i-th card from the top of the deck. It is guaranteed that each number from 1 to n appears exactly twice.
Output Format
Output a single number — the maximum number of points that can be scored.
Examples
Note
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].