N = gets.to_i
S = gets.chomp

whites = []
blacks = []

if S[0] == '.'
  whites << 1
  blacks << 0
else
  whites << 0
  blacks << 1
end

(1...(S.length)).each do |i|
  if S[i] == '.'
    whites << whites[i-1] + 1
    blacks << blacks[i-1]
  else
    whites << whites[i-1]
    blacks << blacks[i-1] + 1
  end
end

res = [whites[N-1], blacks[N-1]].min

(1...(N)).each do |i|
  res2 = blacks[i-1] + whites[N-1] - whites[i-1]
  res = [res, res2].min
end

p res
