# 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 main(N, S):
    lc = 0
    rc = 0
    for i in range(N):
        if S[i] == '.':
            lc += 1
        else:
            break
    for i in range(N):
        if S[N-1-i] == '#':
            rc += 1
        else:
            break
    wc = 0
    bc = 0
    for i in range(lc, N-rc):
        if S[i] == '.':
            wc += 1
        else:
            bc += 1
    ans = min(wc, bc)
    print(ans)

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