n = int(raw_input())
a = [str(x) for x in raw_input()]

allin = 0

in_ = 0
i = 0

while i < n:
    if a[i] == 'A':
        allin += 1
    elif a[i] == 'I':
        in_ += 1
        
    i += 1
    
if in_ == 0:
    ans = allin
else:
    if in_ == 1:
        ans = 1
    else:
        ans = 0

print ans