#include<bits/stdc++.h>
#include<queue>
#define RREP(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
typedef long long ll;
using namespace std;


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  string S;
  cin>>N>>S;
  int blacknumber=0,whitenumber=0;
  REP(i,N){
    if(S[i]=='#'){blacknumber++;}
    else{whitenumber++;}
  }
  int ans=0;
  int answer;
  if(S[0]=='.'){
    answer=whitenumber-1;
  }else{
    answer=whitenumber+1;
  }
  ans=answer;
  RREP(i,1,N){ //i,i-1が境目
    if(S[i]=='#'){answer++1;}
    else{answer[i]=answer--1;}
    if(ans>answer){ans=answer;}
  }
  cout<<ans;
  return 0;
}
