N = int(eval(input()))

S = str(eval(input()))

# '.'の場合は白, '#'の場合は黒



if S[0] == '.':

    count_white = [1]

    count_black = [0]

else:

    count_white = [0]

    count_black = [1]





for i in range(1, N):

    if S[i] == '.':

        # 見ている石が白なら

        count_white.append(count_white[i-1]+1)

        count_black.append(count_black[i-1])

    else:

        # 見ている石が黒なら

        count_white.append(count_white[i-1])

        count_black.append(count_black[i-1]+1)



tmp = 9999999999

for i in range(1, N):

    min_sum = 0

    min_sum += count_black[i-1]

    min_sum += (count_white[N-1] - count_white[i])

    tmp = min(tmp, min_sum)



# print(tmp)



cnt = 0

target = S[0]

for i in range(1, N):

    if target == '#' and S[i] == '.':

        cnt += 1

        target = '#'  # 黒に変える

        continue



    if S[i] == '#':

        target = '#'

    else:

        target = '.'



cnt_2 = 0

aim = S[-1]

for i in range(N-1, -1, -1):

    if aim == '.' and S[i] == '#':

        cnt_2 += 1

        aim = '.'

        continue



    if S[i] == '#':

        aim = '#'

    else:

        aim = '.'





print((int(min(cnt, cnt_2, tmp))))



n = int(eval(input()))

s = eval(input())



b = [0]  # 黒の累積和

w = [0]  # 白の累積和



count_b = 0

count_w = 0

for i in range(n):

    if s[i] == "#":

        # 黒なら

        count_b += 1

    else:

        # 白なら

        count_w += 1

    b.append(count_b)

    w.append(count_w)



ans = n

for i in range(n+1):

    ans = min(ans, b[i]+w[-1]-w[i])

print(ans)

N = int(eval(input()))
S = str(eval(input()))
# '.'の場合は白, '#'の場合は黒
if S[0] == ".":
    count_white = [1]
    count_black = [0]
else:
    count_white = [0]
    count_black = [1]
for i in range(1, N):
    if S[i] == ".":
        # 見ている石が白なら
        count_white.append(count_white[i - 1] + 1)
        count_black.append(count_black[i - 1])
    else:
        # 見ている石が黒なら
        count_white.append(count_white[i - 1])
        count_black.append(count_black[i - 1] + 1)
tmp = 9999999999
for i in range(1, N):
    min_sum = 0
    min_sum += count_black[i - 1]
    min_sum += count_white[N - 1] - count_white[i]
    tmp = min(tmp, min_sum)
# print(tmp)
cnt = 0
target = S[0]
for i in range(1, N):
    if target == "#" and S[i] == ".":
        cnt += 1
        target = "#"  # 黒に変える
        continue
    if S[i] == "#":
        target = "#"
    else:
        target = "."
cnt_2 = 0
aim = S[-1]
for i in range(N - 1, -1, -1):
    if aim == "." and S[i] == "#":
        cnt_2 += 1
        aim = "."
        continue
    if S[i] == "#":
        aim = "#"
    else:
        aim = "."
print((int(min(cnt, cnt_2, tmp))))

n = int(eval(input()))
s = eval(input())
b = [0]  # 黒の累積和
w = [0]  # 白の累積和
count_b = 0
count_w = 0
for i in range(n):
    if s[i] == "#":
        # 黒なら
        count_b += 1
    else:
        # 白なら
        count_w += 1
    b.append(count_b)
    w.append(count_w)
ans = n
for i in range(n + 1):
    ans = min(ans, b[i] + w[-1] - w[i])
print(ans)

-N = int(eval(input())) -S = str(eval(input())) -# '.'の場合は白, '#'の場合は黒 -if S[0] == ".": -    count_white = [1] -    count_black = [0] -else: -    count_white = [0] -    count_black = [1] -for i in range(1, N): -    if S[i] == ".": -        # 見ている石が白なら -        count_white.append(count_white[i - 1] + 1) -        count_black.append(count_black[i - 1]) +n = int(eval(input())) +s = eval(input()) +b = [0]  # 黒の累積和 +w = [0]  # 白の累積和 +count_b = 0 +count_w = 0 +for i in range(n): +    if s[i] == "#": +        # 黒なら +        count_b += 1 -        # 見ている石が黒なら -        count_white.append(count_white[i - 1]) -        count_black.append(count_black[i - 1] + 1) -tmp = 9999999999 -for i in range(1, N): -    min_sum = 0 -    min_sum += count_black[i - 1] -    min_sum += count_white[N - 1] - count_white[i] -    tmp = min(tmp, min_sum) -# print(tmp) -cnt = 0 -target = S[0] -for i in range(1, N): -    if target == "#" and S[i] == ".": -        cnt += 1 -        target = "#"  # 黒に変える -        continue -    if S[i] == "#": -        target = "#" -    else: -        target = "." -cnt_2 = 0 -aim = S[-1] -for i in range(N - 1, -1, -1): -    if aim == "." and S[i] == "#": -        cnt_2 += 1 -        aim = "." -        continue -    if S[i] == "#": -        aim = "#" -    else: -        aim = "." -print((int(min(cnt, cnt_2, tmp)))) +        # 白なら +        count_w += 1 +    b.append(count_b) +    w.append(count_w) +ans = n +for i in range(n + 1): +    ans = min(ans, b[i] + w[-1] - w[i]) +print(ans)