n = gets.chomp.to_i
s = gets.chomp

btow = []
wtob = []

n.times do |i|
  if i == 0
    btow[i] = (s[i] == '#') ? 1 : 0
    wtob[(n-1)-i] = (s[(n-1)-i] == '.') ? 1 : 0
  else
    btow[i] = btow[i-1] + ((s[i] == '#') ? 1 : 0)
    wtob[(n-1)-i] = wtob[n-i] + ((s[(n-1)-i] == '.') ? 1 : 0)
  end
end

max = [btow[n-1], wtob[0]].min
(n-1).times do |i|
  max = btow[i] + wtob[i+1] if max > btow[i] + wtob[i+1]
end

puts max