#!/usr/bin/env python
#codeforces 186/2
import sys
n = int(sys.stdin.readline())

cnt_i = 0
cnt_a = 0

string = sys.stdin.readline()
for char in string:
    if char == 'I':
        cnt_i += 1
    elif char == 'A':
        cnt_a += 1
    else:
        continue
    if cnt_i>1:
        break

if cnt_i>1:
    print "0"
elif cnt_i == 1:
    print "1"
else:
    print cnt_a
