N = int(input())
S = input()

ans = 0
now = S[0]
# start = S[0]
end = S[-1]
for i in range(N):
    if S[i] != now:
        ans += 1
        now = '#' if now == '.' else '.'
if ans > 1:
    ans -= 1

print(ans)