#!/bin/python                                                               
# -*- coding: utf-8 -*-

n = int(input())
s = input()
ans = 0

for i, c in enumerate(s):
    if c == "F":
        continue
    if not any ([status == "I" for status in s[i + 1:]]):
        ans = ans + 1

print(ans)