K. Kill Bill Vol. 1
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

When the Bride asked Hanzo, the greatest and finest katana forger the world has ever seen, to craft a new weapon, the master was hesitant, as it had been decades since his last creation and the process was rather complicated.

Nevertheless, sympathizing with the Bride's story and mission, Hanzo decided to call you — the smartest person he knows — and explain step-by-step his forging method:

  • Hanzo initially builds the katana by attaching a Japanese steel blade to a hilt and sharpens the blade in the conventional way;
  • After that, the master divides the blade into $$$N$$$ parts and assigns a value to each part based on its sharpness level;
  • Now, Hanzo aims to minimize the number of distinct sharpness values on the blade by choosing two distinct parts of the blade that have the same sharpness level and modifying all parts between them to also have that same level.

More formally, let $$$a_i$$$ be the sharpness value of the $$$i$$$-th part of Hanzo's blade. The operation is defined as follows:

  1. Choose two indices $$$i$$$ and $$$j$$$ $$$(1 \le i \lt j \le N)$$$ such that $$$a_i = a_j$$$;
  2. For every $$$k$$$ $$$(i \lt k \le j)$$$, assign $$$a_k := a_i$$$.

Hanzo stated that the sharpness of the blade is the most important part of forging a great katana. However, it is also by far the most difficult step, and he feels he's not always making the most of the blade. Therefore, help him minimize the number of distinct sharpness values by developing a program that receives the initial sharpness levels of the blade and performs Hanzo's operation any number of times.

Input

The input consists of two lines. The first line contains a single integer $$$N$$$ $$$(1 \le N \le 2 \cdot 10^5)$$$, the number of parts into which Hanzo divided the blade. The second line contains $$$N$$$ numbers $$$(1 \le a_i \le 10^9)$$$, the sharpness values of each part of the blade.

Output

Print a single integer, the minimum number of distinct sharpness values on the blade after applying the process described by Master Hanzo.

Examples
Input
5
1 2 2 2 1
Output
1
Input
7
1 2 3 1 4 5 4
Output
2
Input
3
1 2 3
Output
3