import math
import re
n = int(raw_input())
s = raw_input()

prev = ''
ar = []
for i in s:
    if prev == '' or prev[0] == i:
        prev += i
    else:
        ar.append(prev)
        prev = i

ar.append(prev)

tmp = {
    "black": 0,
    "white":0
}
prev = ''

for a in ar:
    if prev.count('#') > 0:
        cur = {
            "black": tmp["black"] + len(prev),
            "white": tmp["white"]
        }
    else:
        cur = {
            "black": tmp["black"],
            "white": tmp["white"]
        }
    if a.count('.') > 0:
        tmp["white"] += len(a)

    if (tmp["black"] + tmp["white"]) >= (cur["black"] + cur["white"]):
        tmp["black"] = cur["black"]
        tmp["white"] = cur["white"]
    prev = a

print tmp["black"] + tmp["white"]