#!/usr/bin
from sys import stdin
raw_input()
allin, iN, fold = 'A', 'I', 'F'
poker = { allin: 0, iN: 0, fold: 0 }
for r in stdin.readline().strip():
    poker[r] += 1
if poker[iN] == 1:
    print 1
elif poker[iN] == 0:
    print poker[allin]
else: print 0