x=input()
y=raw_input()
y=y[:x]
d={}
for i in range(0,len(y)):
	if y[i] in d:
		d[y[i]]=+1
	else:
		d[y[i]]=1
count=0
u='I'
for i in range(0,len(y)):
	if y[i]=='A' or y[i]=='I':
		d[y[i]]-=1
		if u in d:
			if d[u] == 0:
				count+=1		
		else:
			count+=1
	d[y[i]]+=1
print count
