n=int(eval(input()))

S=list(eval(input()))

if len(set(S))==1:

    print((0))

    exit()

W,B=[0]*n,[0]*n

if S[0]=='.':

    W[0]=1

else:

    B[0]=1

for i in range(1,n):

    if S[i]=='.':

        W[i]=W[i-1]+1

        B[i]=B[i-1]

    else:

        W[i]=W[i-1]

        B[i]=B[i-1]+1

cnt1=float('inf')

for i in range(n-1):

    w=W[i]

    b=B[-1]-B[i]

    tmp=n-w-b

    cnt1=min(cnt1,tmp)

for i in reversed(list(range(n))):

    if S[i]=='.':

        break

cnt2=S[:i+1].count('#')

for i in range(n-1):

    if S[i]=='#':

        break

cnt3=S[i+1:].count('.')

print((min(cnt1,cnt2,cnt3)))
n=int(eval(input()))

S=list(eval(input()))

W,B=[0]*(n+1),[0]*(n+1)

for i in range(n):

    if S[i]=='.':

        W[i+1]=W[i]+1

        B[i+1]=B[i]

    else:

        W[i+1]=W[i]

        B[i+1]=B[i]+1

ans=float('inf')

for i in range(n+1):

    w=W[i]

    b=B[-1]-B[i]

    tmp=n-w-b

    ans=min(ans,tmp)

print(ans)
n = int(eval(input()))
S = list(eval(input()))
if len(set(S)) == 1:
    print((0))
    exit()
W, B = [0] * n, [0] * n
if S[0] == ".":
    W[0] = 1
else:
    B[0] = 1
for i in range(1, n):
    if S[i] == ".":
        W[i] = W[i - 1] + 1
        B[i] = B[i - 1]
    else:
        W[i] = W[i - 1]
        B[i] = B[i - 1] + 1
cnt1 = float("inf")
for i in range(n - 1):
    w = W[i]
    b = B[-1] - B[i]
    tmp = n - w - b
    cnt1 = min(cnt1, tmp)
for i in reversed(list(range(n))):
    if S[i] == ".":
        break
cnt2 = S[: i + 1].count("#")
for i in range(n - 1):
    if S[i] == "#":
        break
cnt3 = S[i + 1 :].count(".")
print((min(cnt1, cnt2, cnt3)))

n = int(eval(input()))
S = list(eval(input()))
W, B = [0] * (n + 1), [0] * (n + 1)
for i in range(n):
    if S[i] == ".":
        W[i + 1] = W[i] + 1
        B[i + 1] = B[i]
    else:
        W[i + 1] = W[i]
        B[i + 1] = B[i] + 1
ans = float("inf")
for i in range(n + 1):
    w = W[i]
    b = B[-1] - B[i]
    tmp = n - w - b
    ans = min(ans, tmp)
print(ans)

-if len(set(S)) == 1: -    print((0)) -    exit() -W, B = [0] * n, [0] * n -if S[0] == ".": -    W[0] = 1 -else: -    B[0] = 1 -for i in range(1, n): +W, B = [0] * (n + 1), [0] * (n + 1) +for i in range(n): -        W[i] = W[i - 1] + 1 -        B[i] = B[i - 1] +        W[i + 1] = W[i] + 1 +        B[i + 1] = B[i] -        W[i] = W[i - 1] -        B[i] = B[i - 1] + 1 -cnt1 = float("inf") -for i in range(n - 1): +        W[i + 1] = W[i] +        B[i + 1] = B[i] + 1 +ans = float("inf") +for i in range(n + 1): -    cnt1 = min(cnt1, tmp) -for i in reversed(list(range(n))): -    if S[i] == ".": -        break -cnt2 = S[: i + 1].count("#") -for i in range(n - 1): -    if S[i] == "#": -        break -cnt3 = S[i + 1 :].count(".") -print((min(cnt1, cnt2, cnt3))) +    ans = min(ans, tmp) +print(ans)