import fractions,math,sys

from collections import Counter

n = int(eval(input()))

s = list(eval(input()))

cnt = Counter(s)

white_l = 0

black_l = 0

min = cnt['.']

for i in range(n):

    if s[i] == '#':

        black_l += 1

        cnt['#'] -= 1

    else:

        white_l += 1

        cnt['.'] -= 1

    if black_l + cnt['.'] < min:

        min = black_l + cnt['.']

print(min)



n = int(eval(input()))

s = eval(input())

white = s.count('.')

black = 0

min = white

for i in range(n):

    if s[i] == '#':

        black += 1

    else:

        white -= 1

    if black + white < min:

        min = black + white 

print(min)



import fractions, math, sys
from collections import Counter

n = int(eval(input()))
s = list(eval(input()))
cnt = Counter(s)
white_l = 0
black_l = 0
min = cnt["."]
for i in range(n):
    if s[i] == "#":
        black_l += 1
        cnt["#"] -= 1
    else:
        white_l += 1
        cnt["."] -= 1
    if black_l + cnt["."] < min:
        min = black_l + cnt["."]
print(min)

n = int(eval(input()))
s = eval(input())
white = s.count(".")
black = 0
min = white
for i in range(n):
    if s[i] == "#":
        black += 1
    else:
        white -= 1
    if black + white < min:
        min = black + white
print(min)

-import fractions, math, sys -from collections import Counter - -s = list(eval(input())) -cnt = Counter(s) -white_l = 0 -black_l = 0 -min = cnt["."] +s = eval(input()) +white = s.count(".") +black = 0 +min = white -        black_l += 1 -        cnt["#"] -= 1 +        black += 1 -        white_l += 1 -        cnt["."] -= 1 -    if black_l + cnt["."] < min: -        min = black_l + cnt["."] +        white -= 1 +    if black + white < min: +        min = black + white