#!/bin/python

n = int(raw_input())

s = raw_input()

I = [s.index(i) for i in s if i == 'I']
A = [s.index(i) for i in s if i == 'A']

if len(I) > 1:
    print '0'
elif len(I) == 1:
    print '1'
else:
    print len(A)
