N = int(input())
S = input()
ans = 0
kuro_count = 0
shiro_count = 0
t = 0
i = 0
is_shiro = False
while True:
  if i == N-1:
    break
  if S[i] == "#":
    for j in range(i, N-1):
      if S[j] == "#":
        kuro_count += 1
      else:
        shiro_count += 1
        if S[j+1] == "#":
          t = j
          break
    if kuro_count < shiro_count:
      ans += kuro_count
    i += t
  i += 1
print(ans)