If n is odd, the median is the number ranked
if we sort the sequence in ascending order
If n is even, the median is the number that has more occurences between the
numbers ranked
if
we sort the sequence in ascending order. If they appeared for the same number
of times the smaller one is the median.
Define the shikness of a sequence A as the number of
occurences of the median of A.
Define the nitness of a sequence A as the maximum shikness over all continuous subsequences of A.
You want to find a sequence A of length n, satisfying 1≤Ai≤3 for every 1≤i≤n, with the minimum nitness.
Calculate the nitness of such sequence.
The first line of each test case contains
one integer n (1≤n≤10^9).
6
1
2
3
4
5
6
1
1
1
2
2
2