#!/usr/bin
from sys import stdin
raw_input()
game = stdin.readline().strip()
k = game.find('I')
if k == -1:
    if game.find('A') != -1:
        print game.count('A')
    else: print 0
elif game.find('I', -~k) != -1:
    print 0
else: print 1