

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 :
    print(0)
    exit(0)

if s.count('A') == 0 :
    for i in range(n):
        if s[i] == 'I':
            cnt1 +=1

elif s.count('I') == 0 :
    for i in range(n):
        if s[i] == 'A':
            cnt1 += 1


for i in range(n):
    if s[i] == 'I':
        cnt1 +=1

print(cnt1)




