d=int(raw_input())
x=raw_input()
allin=0
ins=0
F=0
for i in range(0,len(x)):
    
    if(x[i:i+1]=='A'):
        allin+=1
    if(x[i:i+1]=='I'):
        ins+=1
    if(x[i:i+1]=='F'):
        F+=1    
    if ins==2:
        print(0)
        break
if F==len(x):
   print(0) 
if allin>=1 and ins==0:
    print(allin)
if ins==1 and allin>=1:
    print ins
