n = int(raw_input())

cows = list(raw_input())

a = i = 0

for i in xrange(n):
    if cows[i] == "A":
        a += 1

    elif cows[i] == "I":
        i += 1

if i == 1:
    print 1
elif i == 0:
    print a
else:
    print 0
