fi=raw_input()
n=list(raw_input())
d=sorted(n)
if d[0]==d[-1]=="F" or d[0]==d[-1]=="I":
    print(0)
elif d[0]==d[-1]=="A":
    print(len(d))
elif len(set(d))==3:
    print(d.count("I"))
elif d[0]=="F" and d[-1]=="I" or d[0]=="A" and d[-1]=="I":
    print(d.count("I"))
else:print(d.count("A"))
        