# -*- coding: utf-8 -*-
import sys


def some_func():
    """
    """
    n = input()
    n_str = map(str,sys.stdin.readline().split())[0]

    a=n_str.count('A')
    b=n_str.count('F')
    c=n_str.count('I')

    if c>1:
        print 0
    elif c==1:
        print 1
    else:
        print a








if __name__ == '__main__':
    some_func()





