n = int(input())
s = input().strip()

allw = 0
allb = 0
tmpb = 0
ss = True if s[0] == '.' else False
for _s in s:
  if not ss and _s == '.':
    allb += 1
    if tmpb > 0:
      allw += tmpb
  elif _s == '#':
    tmpb += 1
    ss = False
print(min(allw, allb))
