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

X = [0 if x == '#' else 1 for x in S]
Y = list(reversed(X))

if 0 not in X or 1 not in X:
    ans = 0 
else:
    idx = X.index(1) # first black
    X = sum(X[idx:])
    Y = N - idx - X - Y.index(0) + 1
    ans = min(X, Y)

print(ans)