n = int(input())
s = list(input())
white = s.count(".")
diff = 0
diff_min = 0
for i in range(n):
    diff += (1 if s[i] == "#" else -1)
    diff_min = min(diff, diff_min)
        
print(white + diff_min)