import sys
N = int(sys.stdin.readline())
S = sys.stdin.readline()
in_count = S.count('I')
if in_count > 1:
    print(0)
    exit(0)
if in_count == 1:
    print(1)
    exit(0)
res = S.count('A')
print(res)
