n = int(input())
s = input()

if "." not in s or "#" not in s:
    print(0)
else:
    ans = len(s)

    s = s[s.find("#"):n-s[::-1].find(".")]
    cnt_b = [0 for i in range(len(s))]
    cnt = 0
    for i in range(len(s)):
        if s[i] == "#":
            cnt += 1
        cnt_b[i] = cnt
    ans = min(ans, len(s)-cnt_b[-1])
    for i in range(len(s)):
        ans = min(ans, cnt_b[i] + (len(s)-cnt_b[-1])-(i+1-cnt_b[i]))
    print(ans)
