#br = open('b.in')
n = int(raw_input())
s = raw_input()
a, i, f, r = s.count('A'), s.count('I'), s.count('F'), 0
for c in s:
  if (c == 'A' and a - 1 > 0) or (c == 'I' and a > 0):
    r += 1
print [0, r][f > 0]
