#python 2.7.10
#arthur
#bsearch, two pointers, ds
from sys import stdin
#def modpow(a,b,n):
#    """returns the result of a^bmodn"""
#    res = 1
#    while b>0:
#        if b%2==1:
#            res = (res*a)%n
#        b = b>>1
#        a = (a*a)%n
#    return res
def main():
    n = int(raw_input())
    S = raw_input()
    cnt=0
    for c in S:
        if c=='I':
            cnt+=1
    ans = 0
    for c in S:
        if c=='I' and cnt==1:
            ans+=1
        if c=='A' and cnt==0:
            ans+=1
    return ans
if __name__=='__main__':
    print main()
