def main():
	N = int(input())
	seq = input().strip()
	
	numbers = [dict() for _ in range(N)]
	for i, c in enumerate(seq):
		numbers[i][c] = 1
	max_len = 0
	for size in range(2, N+1):
		for i in range(N-1, size-2, -1):
			numbers[i] = add(numbers[i-1], seq[i])
			max_len = max(max_len, compute_seq(numbers[i]))
	print(max_len)


def compute_seq(d):
	total = 0
	was_odd = False
	for value in d.values():
		if value % 2 == 1:
			if was_odd:
				return 0
			was_odd = True
		total += value
	return total


def add(d1, c):
	d2 = d1.copy()
	if c not in d2:
		d2[c] = 0
	d2[c] += 1
	return d2


main()

