N = int(input())
S = list(input())
A = []
B = []
for i in range(N):
    if S[i] == "#":
        A.append(i)
for i in range(N):
    if S[i] == ".":
        B.append(i)

try:
    ans1 = N-min(A)-len(A)
except:
    ans1 = 0
try:
    ans2 = N-max(A)+max(B)-len(B)
except:
    ans2 = 0
print(min(ans1,ans2))
