#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 i == 0 and (a - 1 > 0 or f > 0)) or (c == 'I' and i - 1 == 0 and (a > 0 or f > 0)):
    r += 1
print r
