

function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  var S = input[1].split("");
  var cnts=0;
  var cnt=[0];
  var ans=N;
  for(var i=0;i<N;i++){
    if(S[i]=="#"){
      cnts++;
      cnt.push(cnts);
    }else{
      cnt.push(cnts);
    }
  }
  for(var i=0;i<N+1;i++){
    ans=Math.min(cnt[i]+N-i-(cnt[N]-cnt[i]),ans);
  }

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));