import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    s = input()
    flg = False
    w = [0] * n
    cnt = 0
    for i in range(n):
        if not flg:
            if s[i] == "#":
                flg = True
        if flg:
            if s[i] == ".":
                cnt += 1
            w[i] = cnt
    flg = False
    b = [0] * n
    cnt = 0
    for i in reversed(range(n)):
        if not flg:
            if s[i] == ".":
                flg = True
        if flg:
            if s[i] == "#":
                cnt += 1
            b[i] = cnt

    res = f_inf
    for i, j in zip(w, b):
        res = min(res, i + j)
    print(res)


if __name__ == '__main__':
    resolve()
