n = int(input())
s = input()
b_cnt = 0
w_cnt = 0
ans = 0
for i in range(n):
  if s[i] == '#' and w_cnt == 0:
    b_cnt += 1
  elif s[i] == '#' and w_cnt > 0:
    ans += min(b_cnt, w_cnt)
    if b_cnt > w_cnt:
      b_cnt += 1
      w_cnt = 0
    else:
      b_cnt = 1
      w_cnt = 0
  elif s[i] == '.':
    w_cnt += 1
ans += min(b_cnt, w_cnt)
print(ans)
