1
2
3
4
N = int(input())
results = input()
group_size = N // 10
print(sum([results[i] == 'T' and len(set(results[i:i+group_size])) == 1 for i in range(0, N, group_size)]))