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

N = gets.to_i
S = gets.chomp

S2 = S.dup

th = 0

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

# 0～i+1 までの'#'の数と
# i+2 ～ N-1 までの'.'の数をカウントすればよい。

ans1 = 0
ans2 = 0

(0..th).each do |i|
  if S[i] == '#' then 
    S2[i] = '.'
    ans1 += 1

#    if S2 == S2.sort.reverse then
#      break
#    end

  end
end

if S2 == S2.split.sort.reverse then
  pus ans1
  exit
end

if th+1 <= N-1 then
  (th+1..N-1).each do |i|
    if S[i] == '.' then 
      ans2 += 1
    end
  end
end

if th == 0 then
  puts 0
elsif 
  puts ans1+ans2
end

