N = gets.to_i
S = gets.chomp.chars.take(N)

s = S.drop_while { |ch| ch == '.' }.reverse
  .drop_while { |ch| ch == '#' }.reverse

list = []
white_count = 0
black_count = 0
s.each.with_index do |ch, i|
  if ch == '#'
    if white_count > 0
      list.push([black_count, white_count])
      black_count = 1
      white_count = 0
    else
      black_count += 1
    end
  else
    white_count += 1
    list.push([black_count, white_count]) if i == s.size - 1
  end
end
dp = Array.new(list.size + 10)
dp[0] = { 'white' => 0, 'black' => 0}
list.each.with_index do |(black_count, white_count), i|
  dp[i + 1] = {}
  dp[i + 1]['white'] = dp[i]['white'] + black_count
  dp[i + 1]['black'] = [
    dp[i]['white'] + white_count,
    dp[i]['black'] + white_count,
  ].min
end
ans = [dp[list.size]['white'], dp[list.size]['black']].min
puts ans
