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