N = int(eval(input()))

s = eval(input())



BK = '#'



c_bk = [0]

t_bk = 0



c_wt = [0]

t_wt = 0



for ss in s:

    if ss == BK:

        t_bk += 1

    else:

        t_wt += 1



    c_bk.append(t_bk)

    c_wt.append(t_wt)



ans = N

for i in range(0, N + 1):

    to_white = c_bk[i] - c_bk[0]

    to_black = c_wt[N] - c_wt[i]

    ans = min(ans, to_black + to_white)



print(ans)

# https://atcoder.jp/contests/tenka1-2019/tasks/tenka1_2019_c



n = int(eval(input()))

s = eval(input())



tot_w = s.count('.')



ret = tot_w  # 初期配置をすべて黒にした場合にして、左端から白を置いていく

w = 0

b = 0

for c in s:

    if c == '#':

        b += 1

    else:

        w += 1

    cost = b + tot_w - w

    ret = min(ret, cost)



print(ret)

N = int(eval(input()))
s = eval(input())
BK = "#"
c_bk = [0]
t_bk = 0
c_wt = [0]
t_wt = 0
for ss in s:
    if ss == BK:
        t_bk += 1
    else:
        t_wt += 1
    c_bk.append(t_bk)
    c_wt.append(t_wt)
ans = N
for i in range(0, N + 1):
    to_white = c_bk[i] - c_bk[0]
    to_black = c_wt[N] - c_wt[i]
    ans = min(ans, to_black + to_white)
print(ans)

# https://atcoder.jp/contests/tenka1-2019/tasks/tenka1_2019_c
n = int(eval(input()))
s = eval(input())
tot_w = s.count(".")
ret = tot_w  # 初期配置をすべて黒にした場合にして、左端から白を置いていく
w = 0
b = 0
for c in s:
    if c == "#":
        b += 1
    else:
        w += 1
    cost = b + tot_w - w
    ret = min(ret, cost)
print(ret)

-N = int(eval(input())) +# https://atcoder.jp/contests/tenka1-2019/tasks/tenka1_2019_c +n = int(eval(input())) -BK = "#" -c_bk = [0] -t_bk = 0 -c_wt = [0] -t_wt = 0 -for ss in s: -    if ss == BK: -        t_bk += 1 +tot_w = s.count(".") +ret = tot_w  # 初期配置をすべて黒にした場合にして、左端から白を置いていく +w = 0 +b = 0 +for c in s: +    if c == "#": +        b += 1 -        t_wt += 1 -    c_bk.append(t_bk) -    c_wt.append(t_wt) -ans = N -for i in range(0, N + 1): -    to_white = c_bk[i] - c_bk[0] -    to_black = c_wt[N] - c_wt[i] -    ans = min(ans, to_black + to_white) -print(ans) +        w += 1 +    cost = b + tot_w - w +    ret = min(ret, cost) +print(ret)