n = int(raw_input())
s = list(raw_input())
rez = 0
if s.count('I') == 0:
    print s.count('A')
else:
    rev_idx = s[::-1].index('I')
    rez = 1
    for i in range(-rev_idx,0):
        if s[i] == 'A':
            rez+=1
    print rez
