#!/usr/bin/ruby
# encoding: utf-8

N = gets.to_i
S = gets.chomp

# 累積和の配列
ruiW = Array.new(N+1,0) # 白石の累積和
ruiB = Array.new(N+1,0) # 黒石の累積和

(0..N-1).each do |i|
  if S[i] == '.' then
    ruiW[i+1] = ruiW[i] + 1
  elsif
    ruiW[i+1] = ruiW[i]
  end
end

(0..N-1).each do |i|
  if S[i] == '#' then
    ruiB[i+1] = ruiB[i] + 1
  elsif
    ruiB[i+1] = ruiB[i]
  end
end

#puts "ruiB = #{ruiB}"
#puts "ruiW = #{ruiW}"

numB = 0
numW = 0
ans = 1000000
tmp = 1000000

(0..N-1).each do |i|
  numB = ruiB[i+1] 
  numW = ruiW[N] - ruiW[i+1] 
#  puts "numB = #{numB}"
#  puts "numW = #{numW}"
  tmp = numB + numW 
  if ans >= tmp then
    ans = tmp
  end
end

puts ans
