raw_input()
gamers = {}
for i in raw_input():
    if i in gamers:
        gamers[i] += 1
    else:
        gamers[i] = 1

if (gamers.get('I', 0) > 1):
    print(0)
else:
    print(1 if gamers.get('I', 0) == 1 else gamers.get('A', 0))