N = gets.to_i
S = gets.chomp

p = S.rindex('.') || 0
bc = 0
wc = 0
ans = 0

(p).downto(0) do |i|
  if S[i] == '#'
    bc += 1
  else
    wc += 1
  end

  if bc > wc
    ans += wc
    bc = 0
    wc = 0
  end
end

puts ans + [bc, wc].min