Description
You are given integers $N$ and $X$, and an integer sequence $A = (A_1, A_2, \dots, A_N)$ of length $N$. You will construct an integer sequence $s = (s_1, s_2, \dots, s_N)$ of length $N$ that satisfies all of the following conditions:
- $1 \le s_i \le X$
- $s_i \neq A_i$ ($1 \le i \le N$)
Find the maximum possible number of indices $i$ ($1 \le i < N$) such that $s_i = s_{i+1}$.
Input
The input is given in the following format:
N X A_1 A_2 ... A_N
- $1 \le N \le 5 \times 10^5$
- $2 \le X \le 10^9$
- $1 \le A_i \le X$ ($1 \le i \le N$)
- All input values are integers.
Output
Print the answer.
Examples
Input 1
8 3 1 2 2 3 2 1 2 1
Output 1
5
Input 2
4 8 7 6 3 8
Output 2
3
Note
In the first test case, for example, if we choose $s = (3, 3, 1, 1, 3, 3, 3, 3)$, then the indices $i$ such that $s_i = s_{i+1}$ are $1, 3, 5, 6, 7$, for a total of $5$. It can be shown that it is impossible to make $s_i = s_{i+1}$ hold for more indices than this, so the answer is $5$.
In the second test case, for example, we can choose $s = (5, 5, 5, 5)$.