n=int(raw_input())
y=raw_input()
a=y.count('I')
b=y.count('F')
c=y.count('A')
count=0
for i in y:
    if i=='I':
        if a-1==0 and b+c==n-1:
            count+=1
    elif i=='A':
        if b+c-1==n-1:
            count+=1
print count