n = int(input())
s = list(input())
s_r = list(reversed(s))
b_c = 0
h_c = 0
ans = 0
for i in range(n-1):
    if s[i]!=s[i+1]:
        if (b_c==1 and h_c==0) or (h_c==1 and b_c==0):
            ans += 1
            s[i+1] = s[i] 
        else:
            if s[i]=='#':
                b_c = 1
                h_c = 0
            else:
                b_c = 0
                h_c = 1
    else:
        if s[i]=='#':
            b_c += 1
        else:
            h_c += 1 
print(ans)
