#! /bin/python
n = int(raw_input())
s = raw_input()
#I = [s.index(i) for i in s if i == 'I']
#A = [s.index(i) for i in s if i == 'A']
I = 0
A = 0
for i in s:
    if i == 'I':I += 1
    elif i == 'A': A += 1

#print I,A
if I > 1:
    print '0'
elif I == 1:
    print '1'
else:
    print A
