n = int(input())
s = list(input())
cd = 0
cs = 0
ans = 0

if (s[0] == '#'):
  for i in range(n):
    if (s[i] == '.'):
      break
    elif (s[i] == '#'):
      cs += 1

for i in range(cs, n):
  if (s[i] == '.'):
      cd += 1
  elif (s[i] == '#'):
    break

if (cs < cd):
  ans += cs
  s[0:cs + cd] = ''

s = s[::-1]

if (s[0] == '.'):
  for i in range(n):
    if (s[i] == '#'):
      break
    elif (s[i] == '.'):
      cd += 1

for i in range(cd, n):
  if (s[i] == '#'):
      cs += 1
  elif (s[i] == '.'):
    break

if (cd < cs):
  ans += cd
  s[0:cd + cs] = ''


ans1 = s.count('.')
ans2 = s.count('#')
print(min([ans1, ans2]) + ans)
