n = int(input())
s = input()

ans = 0

wh,bl = 0,0

for i in s:
  if i == '.':
    wh += 1
  else:
    if bl > 0 and wh > 0:
      ans += min(bl,wh)
      bl = 0
    wh = 0
    bl += 1
if bl > 0 and wh > 0:
  ans += min(bl, wh)
print (ans)