# Tenka1 Programmer Beginner Contest 2019
# https://atcoder.jp/contests/tenka1-2019-beginner
# 
# 

import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def grouping(N, S):
    g = []
    s = S[0]
    c = 1
    for i in range(1, N):
        if S[i] == s:
            c += 1
        else:
            g.append((s, c))
            c = 1
            s = S[i]
    g.append((s, c))
    return g

def main(N, S):
    g = grouping(N, S)
    gl = len(g)
    l = 0
    r = gl - 1
    if g[l][0] == '.':
        l += 1
    if g[r][0] == '#':
        r -= 1
    if r - l < 1:
        print(0)
        return
    ll = [0]
    lr = [0]
    lc = 0
    for i in range(l, r, 2):
        ll.append(g[i][1] + ll[-1])
        lr.append(g[i+1][1] + lr[-1])
        lc += 1
    ans = N
    for i in range(lc):
        tl = ll[i]
        tr = lr[lc] - lr[i]
        ans = min(ans, tl + tr)
    print(ans)

N = i2n()
S = i2s()
main(N, S)
