Iahub is training for the IOI. What is a better way to train than playing a Zuma-like game? 

There are *n* balls put in a row. Each ball is colored in one of *k* colors. Initially the row doesn't contain three or more contiguous balls with the same color. Iahub has a single ball of color *x*. He can insert his ball at any position in the row (probably, between two other balls). If at any moment there are three or more contiguous balls of the same color in the row, they are destroyed immediately. This rule is applied multiple times, until there are no more sets of 3 or more contiguous balls of the same color. 

For example, if Iahub has the row of balls [black, black, white, white, black, black] and a white ball, he can insert the ball between two white balls. Thus three white balls are destroyed, and then four black balls become contiguous, so all four balls are destroyed. The row will not contain any ball in the end, so Iahub can destroy all 6 balls.

Iahub wants to destroy as many balls as possible. You are given the description of the row of balls, and the color of Iahub's ball. Help Iahub train for the IOI by telling him the maximum number of balls from the row he can destroy.
The first line of input contains three integers: *n* (1 ≤ *n* ≤ 100), *k* (1 ≤ *k* ≤ 100) and *x* (1 ≤ *x* ≤ *k*). The next line contains *n* space-separated integers *c*<sub class="lower-index">1</sub>, *c*<sub class="lower-index">2</sub>, ..., *c*<sub class="lower-index">*n*</sub> (1 ≤ *c*<sub class="lower-index">*i*</sub> ≤ *k*). Number *c*<sub class="lower-index">*i*</sub> means that the *i*-th ball in the row has color *c*<sub class="lower-index">*i*</sub>.

It is guaranteed that the initial row of balls will never contain three or more contiguous balls of the same color.
def anda_pros_lados(lista_andar, ind):

    R = L = ind

    Lstop = Rstop = False
    while True:
        L -=1
        if L < 0 or lista_andar[L] != lista_andar[L+1]:
            L += 1
            Lstop = True
        R += 1
        if R >= len(lista_andar) or lista_andar[R] != lista_andar[R-1]:
            R -= 1
            Rstop = True
        if Lstop and Rstop: break

    return L, R

def remove_bolas(lista_remover, L, R, first):
    lista_cp = [n for n in lista_remover]
    explodiu = False
    bolas = R - L + 1
    if bolas == 2 and first:
        first = False
        explodiu = True
        del(lista_cp[L:R+1])

    elif not first and bolas >= 3:
        explodiu = True
        del(lista_cp[L:R+1])

    if L > 0 and explodiu:
        L -= 1
        R = L

    return lista_cp, L, R, explodiu, first

def explode(lista, ind, first):
    explodiu = True
    lista_cp = [n for n in lista]

    while explodiu and len(lista_cp) > 0:
    #andando pra frente e pra trás até poder

        if explodiu and first == False:
            ind = L

        L, R = anda_pros_lados(lista_cp, ind)
    #BOOOOM!!
        lista_cp, L, R, explodiu, first = remove_bolas(lista_cp, L, R, first)

    return len(lista) - len(lista_cp)

data = input().split()
n_balls = int(data[0])
k_colors = int(data[1])
x = int(data[2])

row = input().split()
row = [int(row[i]) for i in range(n_balls)]

maior = 0
if n_balls >=2:
    for j in range(0, n_balls):
        if row[j] == x:
            num = explode(row, j, True)
            if num > maior:
                maior = num
print(maior)
	     	  				 	 	   		  		