def isSymetric(substr):
	occurances = {}
	for x in substr:
		if x in occurances:
			occurances[x] += 1
		else:
			occurances[x] = 1
	odd = 0
	for x in occurances:
		if occurances[x] % 2 == 1:
			odd += 1
			if odd > 1:
				return False
	return True


max = 0;
input()
line = input()
for i in range(len(line) + 1):
	for j in range(0, i - max + 1):
		tmpLine = line[j : i]
		if len(tmpLine) > max:
			if isSymetric(tmpLine):
				max = len(tmpLine)
print(max)
				

