N = int(input()) S = list(input()) ans_set = set() for i in range(N-1): a,b = S[i],S[i+1] S[i],S[i+1] = "B","B" ans_set.add(tuple(S)) S[i],S[i+1] = a,b print(len(ans_set))