x=raw_input()
team=raw_input()
players=list(team)
allout=0
inhand=0
for player in players:
	if player is 'A':
		allout=allout+1
	if player is 'I':
		inhand=inhand+1
		if inhand>1:
			print 0
			exit(0)
print max(allout,inhand)