#include "bits/stdc++.h"
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;


int main(){
ll N;
string s;
cin>>N>>s;

ll nai=-100;
for(ll i=0;i<N;i++){s
  if(s[i]=='#'){
    nai = i;
    break;
  }
}

if(nai==-100){
cout<<0<<endl;
return 0;
}

ll allb=0;

for(ll i=nai;i<N;i++){
  if(s[i]=='.'){
    allb++;
  } 
}


ll tmp = allb;

char now = '#';
for(ll i=nai;i<N;i++){

  if(now!=s[i]){
    if(tmp<allb){
      allb=tmp;
    }
  }


  if(s[i]=='#'){
    tmp++;
    now = s[i];
  } 
  else if(s[i]=='.'){
    tmp--;
        now = s[i];

  }
}



cout<<allb<<endl;


}

