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] and (b_c==1 or h_c==1):
        ans += 1
        s[i+1] = s[i] 
    else:
        if s[i]=='#':
            b_c = 1
            h_c = 0
        else:
            b_c = 0
            h_c = 1
ans2 = 0
for i in range(n-1):
    if s_r[i]!=s_r[i+1] and (b_c==1 or h_c==1):
        ans2 += 1
        s_r[i+1] = s_r[i] 
    else:
        if s_r[i]=='#':
            b_c = 1
            h_c = 0
        else:
            b_c = 0
            h_c = 1
print(min(ans,ans2))
