from collections import Counter
s=raw_input
n=int(s())
x = s().strip()
a=Counter(x)
ans=0
for i in x:
    if i=='A':
        if a['I']==0:
            ans+=1
    if i=='I':
        tempI = a[i]-1
        if tempI==0:
            ans+=1
    
print ans
            
        
