n=input()
s=raw_input()
if "I" in s:
    if (len(s.split("I")))>=3:
        print 0   #kisi ko bhi chunenge to ek I reh hi jaayega
    else:
        print 1  #sirf I wala hi dikha sakta hai
else:
    print (len(s.split("A"))-1)