n = int(input())
a = input()
s = list(a)
r = 0

i = 0
while i<len(s) and s[i] == '.':
  i+=1

while i<len(s):
  b = 0
  while i<len(s) and s[i] == '#':
    b+=1
    i+=1
  w = 0
  while i<len(s) and s[i] == '.':
    w+=1
    i+=1
  r += min(b,w)

print(r)
