import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N = int(input())
    if N==1:
        print(0)
    else:
        S = list(input())

        B=[0]*N
        W=[0]*N

        cntb=0
        cntw=0
        for i in range(N):
            if S[i]=='#':
                cntb+=1
                B[i]=cntb
                W[i]=cntw
            else:
                cntw+=1
                B[i]=cntb
                W[i]=cntw
        B=[0]+B
        W=[0]+W

        ans=10**9
        for i in range(1,N+1):
            ans=min(ans,B[i]+W[-1]-W[i])
        print(ans)






resolve()