from collections import Counter
n  = int(input())
s= input()
s = [i for i in s]
c = Counter(s)
s = c.most_common(3)
if len(s)>2:
	print(1)
else:
	out = 0
	for i in s:
		if i[0]=='A':
			out = i[1]
			
	print(out)