

n = int(input())
s = input()
cnt1 = 0
cnt2 = 0

if len(set(s)) == 1 and s[0] == 'F':
    print(0)
    exit(0)

if s.count('A') > 0 and s.count('F') > 0 and s.count('I') == 1  :
    cnt1 = 1

if s.count('A') == 0 and s.count('F') == 0 :
    print(0)
    exit(0)

if s.count('F') >= 0 and s.count('I') == 0  :
    print(s.count('A'))
    exit(0)

if s.count('I') > 1 and s.count('A') > 0 or  s.count('F') > 0 :
    cnt1 = 0

if s.count('I') == 1 and s.count('A') > 0 or s.count('F') > 0:
    cnt1 = 1



print(cnt1)




