n = int(input())
s = input()
sr = s[::-1]

if s == "." * n or s == "#" * n:
    print(0)
else:
    black = s.index("#")
    white = sr.index(".")
    wb = [i for i, x in enumerate(s[black:]) if x == "."]
    bw = [i for i, x in enumerate(sr[white:]) if x == "#"]
    print(min(len(wb), len(bw)))