N = int(input()) S = input() ans = 0 for i in range(len(S) - 1): if S[i] == "A" or S[i + 1] == "A": ans += 1 print(ans)