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

if s == "." * n or s == "#" * n:
    print(0)
else:
    black = s.index("#")
    white = sr.index(".")
    wb = s[black:].count(".")
    bw = sr[white:].count("#")
    print(min(wb, bw))