n = int(raw_input())

an = raw_input()

cnt_a = an.count("A")
cnt_f = an.count("F")
cnt_i = an.count("I")

if cnt_a == 0 or cnt_f == 0:
    print 0
elif cnt_a == 1 and cnt_f >= 1:
    print cnt_i
else:
    print cnt_i + cnt_a