n = int(input())
s = list(input())
ans = 0
color = s[0]
if s[0] == ".":
    curw = 1
    curb = 0
else:
    curb = 1
    curw = 0
if color ==".":
    bool = 1
else:
    bool = 0
for i in range(1,n):
    if s[i] == color:
        if color == ".":
            curw +=1
        else:
            curb += 1
    elif i == n-1 and s[i] != color:
        ans += 1
    else:
        if bool %2 == 0:
            if s[i] == ".":
                curw +=1
            else:
                curb += 1
            color = s[i]
            bool +=1
        else:
            ans += min(curw,curb)
            curw = 0
            curb = 0
            if s[i] ==".":
                curw += 1
            else:
                curb += 1
            color = s[i]
            bool += 1

print(ans)
