from collections import defaultdict, deque, Counter, OrderedDict
from bisect import insort, bisect_right, bisect_left
import threading, sys

def main():
    n = int(input())
    s = input()
    a = s.count('A')
    i = s.count('I')
    ans = 0
    if i == 0:
        ans = a
    else:
        if i == 1:
            ans = 1
    print(ans)

if __name__ == "__main__":
    """sys.setrecursionlimit(400000)
    threading.stack_size(40960000)"""
    thread = threading.Thread(target=main)
    thread.start()