"""
python3 a.py < input.txt
"""
import math
import itertools as it
import heapq

N=int(input())
S=input()

T=[S[0]]
U=[1]
for si in S[1:]:
    if T[-1] == si:
        U[-1] = U[-1]+1
    else:
        T.append(si)
        U.append(1)

lb=None
for i in reversed(range(len(T))):
    if T[i] == "#":
        lb=i
rb=None
for i in range(len(T)):
    if T[i] == "#":
        rb=i
rw=None
for i in range(len(T)):
    if T[i] == ".":
        rw=i

if lb == None or rw == None:
    print(0)
    exit()

nb=0
for i in range(lb, len(T)):
    if T[i] == ".":
        nb = nb+U[i]
nw=0
for i in range(rw):
    if T[i] == "#":
        nw = nw+U[i]
nx=0
for i in range(lb, rb):
    if T[i] == "#":
        nx = nb+U[i]
for i in range(rw, len(T)):
    if T[i] == ".":
        nx = nx+U[i]
print(min([nb, nw, nx]))
