n = int(input())
s = input()
f,ans,b,w = 0,0,0,0
for i in s:
  if i == '#':
    if f == 0:
      ans+= min(b,w)
      b,w = 0,0
    b+=1
    f = 1
  else:
    w +=1
    f = 0
ans += min(b,w)
print(ans)