from Queue import * # Queue, LifoQueue, PriorityQueue
from bisect import * #bisect, insort
from datetime import * 
from collections import * #deque, Counter,OrderedDict,defaultdict
from sets import * #Set
import calendar
import heapq
import math
import copy
import itertools
myread = lambda : map(int,raw_input().split())
def solver():
    n = input()
    line = raw_input()
    A_count = 0
    I_count = 0
    for c in line:
        if c == 'A':
            A_count += 1
        elif c == 'I':
            I_count += 1
    if I_count == 0:
        print A_count
    else:
        print I_count



if __name__ == "__main__":
    solver()
    
