N=int(eval(input()))

S=eval(input())



cnt=0

for s in S:

  if s!="#":

    cnt+=1

ans=cnt



for s in S:

  if s==".":

    cnt-=1

  else:

    cnt+=1

  ans=min(ans,cnt)

print(ans)
n=int(eval(input()))

s=eval(input())

cnt=s.count(".")

ans=cnt

for i in s:

  if i==".":cnt -=1

  else:cnt +=1

  ans=min(ans,cnt)

print(ans)
N = int(eval(input()))
S = eval(input())
cnt = 0
for s in S:
    if s != "#":
        cnt += 1
ans = cnt
for s in S:
    if s == ".":
        cnt -= 1
    else:
        cnt += 1
    ans = min(ans, cnt)
print(ans)

n = int(eval(input()))
s = eval(input())
cnt = s.count(".")
ans = cnt
for i in s:
    if i == ".":
        cnt -= 1
    else:
        cnt += 1
    ans = min(ans, cnt)
print(ans)

-N = int(eval(input())) -S = eval(input()) -cnt = 0 -for s in S: -    if s != "#": -        cnt += 1 +n = int(eval(input())) +s = eval(input()) +cnt = s.count(".") -for s in S: -    if s == ".": +for i in s: +    if i == ".":