x=input()
y=raw_input()
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 ('I' in d and d['I'] ==0) and (('A' in d and d['A'] !=0) or ('F' in d and d['F'] !=0)):
				count+=1
		d[y[i]]+=1
print count
