nums = input()
m = input()

start_mugs = []
best = 0

for i in m:
    start_mugs.append(i)

while len(start_mugs) > best:
    mugs = start_mugs.copy()
    brands = {}
    odd_counter = 0

    for i in mugs:
        try:
            brands[i] += 1
        except:
            brands[i] = 1

    for i in brands:
        if brands[i] % 2 != 0:
            odd_counter += 1

    while odd_counter > 1:
        odd_counter = 0
        curr_remove = mugs.pop(len(mugs) - 1)
        brands[curr_remove] -= 1
        for i in brands:
            if brands[i] % 2 != 0:
                odd_counter += 1

    curr_best = len(mugs)
    if curr_best > best:
        best = curr_best

    start_mugs.pop(0)

print(best)
