n = input()
status = raw_input()

in_count = len(filter(lambda c: c == 'I', status))
if in_count == 0:
    ans = len(filter(lambda c: c == 'A', status)) 
elif in_count == 1:
    ans = 1
else:
    ans = 0

print ans
