n = int(raw_input().strip())
raw = raw_input().strip()
buf = ''
m = 0
lit = []
for i in range(n):
	lit.append(raw[i])
for i in range(n):
	buf = lit[i]
	lit[i] = ' '
	if (buf != 'F') and ('A' in lit) and ('F' in lit):
		m += 1
	lit[i] = buf 
print m
