n = int(input())
s = list(str(input()))
b = 0
w = 0
X = []
for i in range(n):
    if s[i] == '#':
        b += 1
    else:
        w += 1
    if i != n-1:
        if s[i] == '.' and s[i+1] == '#':
            X.append((b, w))
            b = 0
            w = 0
else:
    X.append((b, w))
#print(X)
ans = 0
for i in range(len(X)):
    ans += min(X[i])
print(ans)
