nb_cows = int(input())
status  = input()
in_indx = [x+1 for x, v in enumerate(status) if v == "I"]
if len(in_indx) == 0:
    print(nb_cows - status.count("F"))
else:
    can = 0
    for i, v in enumerate(status):
        if v != "F":
            if max(in_indx) <= i+1:
                can += 1
    print(can)


