import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

#ランレングス圧縮
def rle_comp(S):
     rle = []
     pre = 'X'
     chain = 1
     for c in S:
         if c == pre:
             chain += 1
         else:
             if pre != 'X':
                 rle.append([pre,chain])
             
             pre = c
             chain = 1
     rle.append([pre,chain])
 
     return rle

N = ini()
S = input()
rle_s = rle_comp(S)
w = S.count(".")
b = S.count("#")
if rle_s[-1][0] == "#":
    b -= rle_s[-1][1]
    del rle_s[-1]

wb = 0
#先頭が黒
if rle_s[0][0] == "#":
    wb += rle_s[0][1]
    if len(rle_s) >= 4:
        for v in range(3,len(rle_s),2):
            wb += rle_s[v][1]

#先頭が白
else:
    if len(rle_s) >= 3:
        for v in range(2,len(rle_s),2):
            wb += rle_s[v][1]

if wb != 0:
    print(min(min(w,b),wb))
else:
    print(min(w,b))