#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
S = list(input())
P = S[:]

wlist = []
blist = []
for i in range(N):
    wlist.append('.')
    blist.append('#')

if S != wlist and S != blist:

    if P[-1] =='#' and P != wlist and P != blist:
        count = 0
        while P[-1] == "#":
            P.pop(-1)
            count += 1
        ls = []
        for i in range(N-count):
            ls.append('.')
        for i in range(count):
            ls.append('#')
    elif P[-1] == "." and P != wlist and P != blist:
        count = 0
        while P[-1] == ".":
            P.pop(-1)
            count += 1
        while P[-1] == "#":
            P.pop(-1)
            count += 1
        ls = []
        for i in range(N-count):
            ls.append('.')
        for i in range(count):
            ls.append('#')
    w = 0
    b = 0
    l = 0
    for i in range(N):
        if S[i] != wlist[i]:
            w += 1
        if S[i] != blist[i]:
            b += 1
        if S[i] != ls[i]:
            l += 1
    print(min(w,b,l))
else:
    w =0
    b = 0
    for i in range(N):
        if S[i] != wlist[i]:
            w += 1
        if S[i] != blist[i]:
            b += 1
    print(min(w,b))
    
