N = gets.to_i
S = gets.chomp

black_counts = [0]
white_counts = [0]
S.chars.each_with_index do |c, i|
  black_counts[i + 1] = black_counts[i]
  white_counts[i + 1] = white_counts[i]
  if c == '#'
    black_counts[i + 1] += 1
  elsif c == '.'
    white_counts[i + 1] += 1
  end
end

ans = Float::INFINITY
0.upto(N) do |i|
  # 左の#を.に変え、右の.を#に変える数
  left_black = black_counts[i]
  right_white = white_counts[-1] - white_counts[i]
  ans = [left_black + right_white, ans].min
end

puts ans
