fi=raw_input()
d=sorted(list(raw_input()))
if d[0]==d[-1]=="F" or d[0]==d[-1]=="I":
    print(0)
elif d[0]==d[-1]=="A":
    print(len(d))
elif d.count("I")>1:
    print(0)
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"))