n = gets.to_i
s = gets.chomp

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

  hl = hash_left(s)

  min_num_change = n
  hl.each_with_index do |nn, i|
    min_num_change = [min_num_change, nn + i].min
  end

  ss = repl(s)

  hl = hash_left(s)

  min_num_change = n
  hl.each_with_index do |nn, i|
    min_num_change = [min_num_change, nn + i].min
  end

  min_num_change
end

def hash_left(s)
  a = []
  num_hashes = 0
  s.chars.each do |c|
    if c == '#'
      num_hashes += 1
    else
      a << num_hashes
    end
  end
  a.reverse
end

def repl(s)
  ss = s.chars.map{ |c| c == '.' ? '#' : '.'}.join
  ss.reverse
end