Avin is studying series. A series is called “wave” if the following conditions are satisfied:
1) It contains at least two elements;
2) All elements at odd positions are the same;
3) All elements at even positions are the same;
4) Elements at odd positions are NOT the same as the elements at even positions.
You are given a series with length n. Avin asks you to find the longest “wave” subseries. A subseries is a subsequence of a series.
The first line contains two numbers $ n, c (1 \leq n \leq 100, 000, 1 \leq c \leq 100) $ . The second line contains $ n $ integers whose range is $ [1, c] $ , which represents the series. It is guaranteed that there is always a “wave” subseries.
Print the length of the longest “wave” subseries.
1 2 1 3 2