from __future__ import division;
from bisect import *;
from fractions import Fraction;
import sys;
import math;
import io;

INF = 987654321987654321987654321;

def readint(delimiter=' ') :
	return map(int, raw_input().split(delimiter));

def readstr() :
	return raw_input().split();

def readfloat() :
	return map(float, raw_input().split());

def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    raise ValueError

def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect_left(a, x)
    if i:
        return a[i-1]
    raise ValueError

def find_le(a, x):
    'Find rightmost value less than or equal to x'
    i = bisect_right(a, x)
    if i:
        return a[i-1]
    raise ValueError

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect_right(a, x)
    if i != len(a):
        return a[i]
    raise ValueError

def find_ge(a, x):
    'Find leftmost item greater than or equal to x'
    i = bisect_left(a, x)
    if i != len(a):
        return a[i]
    raise ValueError

if __name__ == '__main__':
	
    tc = input();
    line = raw_input();
    share = {};
    share['A'] = share['F'] = share['I'] = 0;

    for ii in line :
        share[ii] += 1;

    if share['I'] == 1 :
        print 1;
    elif share['I'] == 0 :
        print share['A'];
    else :
        print 0;

    pass