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

a = []
(0...n).each do |i|
  a << i if s[i] == '#'
end

if a.empty?
  puts 0

else
 w = []
 w[0] = a[0] == 0 ? 0 : s[0, a[0]-1].count('#')
(1...a.length).each do |i|
   w[i] = w[i-1] + s[a[i-1], a[i]-a[i-1]].count('#')
end

 b = []
 b[a.length-1] = s[a[-1], n-a[-1]].count('.')
 (a.length-2).downto(0).each do |i|
    b[i] =  b[i+1] + s[a[i], a[i+1]-a[i]].count('.')
  end

  counts = []
  (0...a.length).each do |i|
   counts[i] = w[i] + b[i]
  end
  puts counts.min
end
