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
        if cntb == N or cntb == 0:
            print(0)
        else:

            B = [0] + B + B[-1]
            W = [0] + W + W[-1]

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


resolve()