n = gets.to_i
s = gets.chomp

def num_change(s, n)
  return 0 if s.chars.uniq.size == 1

  min_num_change = n

  num_dots = s.count('.')
  last_dot_index = n
  0.upto(num_dots-1) do |i_dots|
    last_dot_index = s[0...last_dot_index].rindex('.')
    num_hash_to_change = s[0...last_dot_index].count('#')
    min_num_change = [min_num_change, num_hash_to_change + i_dots].min
  end

  num_hashes = s.count('#')
  last_hash_index = 0
  0.upto(num_hashes-1) do |i_hashes|
    last_hash_index = s[last_hash_index...n].index('#') + last_hash_index
    num_dot_to_change = s[last_hash_index...n].count('.')
    min_num_change = [min_num_change, num_dot_to_change + i_hashes].min
  end

  min_num_change
end

puts num_change(s, n)