n = gets.to_i
ary = gets.chomp.split("")

left_black = 0
right_white = ary.count('.')
sary = [[left_black, right_white]]
n.times do |i|
  if ary[i] == '#'
    left_black += 1
  else
    right_white -= 1
  end
  sary << [left_black, right_white]
end

puts sary.map{|a| a.sum }.min