num = int(raw_input().strip())
t = raw_input().strip()
a=i=0
for p in t:
    if p == 'A':
        a+=1
    elif p == 'I':
        i+=1
if i>1:
    print 0
elif i == 1:
    print 1
else:
    print a

    
