n = int(input())
S = list(input())
r = 0
h = 0
r1 = 0
l1 = 0
l2 = S.count(".")
for i in range(n-1):
  if S[i] == "#":
    r1 += 1
  else:
    l1 += 1
  if S[i] == "#" and S[i+1] == ".":
    r = max(r, r1)
    h = max(h, l2-l1)  
print(min(r,h))