from sys import stdin

def line():
	return stdin.readline().strip()

n = int(line())
arr = line()
A = arr.count("A")
I = arr.count("I")
F = arr.count("F")
if I == 0:
	print A
elif I == 1:
	print 1
else:
	print 0
