eval(input());a=eval(input());print((max(len(set(a[:s])&set(a[s:]))for s in range(99))))
_,a=open(0);print((max(len(set(a[:s])&set(a[s:]))for s in range(99))))
eval(input())
a = eval(input())
print((max(len(set(a[:s]) & set(a[s:])) for s in range(99))))

_, a = open(0)
print((max(len(set(a[:s]) & set(a[s:])) for s in range(99))))

-eval(input()) -a = eval(input()) +_, a = open(0)