n = gets.to_i
s = gets.strip
chunked = s.sub(/^\.*/, "").reverse.sub(/^#*/, "").reverse.chars.chunk(&:itself).map{|c, x| [c, x.size] }
ret = chunked.size.times.map do |i|
  head, tail = chunked[0..i], chunked[i+1..-1]
  count = head.map{|c, x| c == "#" ? x : 0 } + tail.map{|c, x| c == "." ? x : 0 }
  count.inject(&:+)
end.min
puts ret