n = int(raw_input().strip())

d = {'A':0, 'F':0, 'I':0}

str = raw_input().strip()
for i in range(n):	
	d[str[i]] += 1

if d['F'] != 0 or d['A'] != 0:
	if d['I'] == 1:
		print d['I']
	elif d['I'] == 0:
		if d['F'] + d['A'] > 0:
			print d['A']
else:
	print 0
