import sys



input = sys.stdin.readline



n = int(eval(input()))

s = list(eval(input()))

res = 10 ** 9



cta = 0

ctb = 0

a = [0] * n

b = [0] * n

for i in range(n):

    if s[i] == ".":

        cta += 1

    else:

        ctb += 1

    a[i] = cta

    b[i] = ctb

for i in range(n):

    res = min(res, b[i] + a[-1] - a[i])

res = min(res, a[-1], b[-1])

print(res)
# TPBC201C - Stones

import sys

input = sys.stdin.readline



n = int(eval(input()))

s = input().rstrip()

ans = 0

blk = 0

for i in s:

    if i == "#":

        blk += 1

    else:

        if blk > 0:

            ans += 1

            blk -= 1

print(ans)

import sys

input = sys.stdin.readline
n = int(eval(input()))
s = list(eval(input()))
res = 10**9
cta = 0
ctb = 0
a = [0] * n
b = [0] * n
for i in range(n):
    if s[i] == ".":
        cta += 1
    else:
        ctb += 1
    a[i] = cta
    b[i] = ctb
for i in range(n):
    res = min(res, b[i] + a[-1] - a[i])
res = min(res, a[-1], b[-1])
print(res)

# TPBC201C - Stones
import sys

input = sys.stdin.readline
n = int(eval(input()))
s = input().rstrip()
ans = 0
blk = 0
for i in s:
    if i == "#":
        blk += 1
    else:
        if blk > 0:
            ans += 1
            blk -= 1
print(ans)

+# TPBC201C - Stones -s = list(eval(input())) -res = 10**9 -cta = 0 -ctb = 0 -a = [0] * n -b = [0] * n -for i in range(n): -    if s[i] == ".": -        cta += 1 +s = input().rstrip() +ans = 0 +blk = 0 +for i in s: +    if i == "#": +        blk += 1 -        ctb += 1 -    a[i] = cta -    b[i] = ctb -for i in range(n): -    res = min(res, b[i] + a[-1] - a[i]) -res = min(res, a[-1], b[-1]) -print(res) +        if blk > 0: +            ans += 1 +            blk -= 1 +print(ans)