n = int(input())
s=input()
"""
c=0
for i in range(n):
    if i==0 and (s[i]=="A" or s[i]=="I") and "I" not in s[i+1:]:
        c=c+1
    elif i==n-1 and (s[i]=="A" or s[i]=="I") and "I" not in s[:n-1]:
        c=c+1
    elif (s[i]=="A" or s[i]=="I") and ("I" not in s[:i] and "I" not in s[i+1:]):
        c=c+1
        """
print(s.count("A"))
        
    
    