#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
    cin>>n;
  string s;
    cin>>s;
  
  vector<int>vec(n);
  vector<int>bec(n);
  
  if(s.at(0)=='#'){
    vec[0]=1;
  }
  else{
    vec[0]=-1;
    bec[0]=1;
  }
  for(int i=1;i<n;i++){
    if(s.at(i)=='#'){
      vec[i]+=1+vec[i-1];
      bec[i]=bec[i-1];
    }
    else{
      vec[i]+=vec[i-1]-1;
      bec[i]+=1+bec[i-1];
    }
  }
   sort(vec.begin(),vec.end());
   cout<<min({(vec[0]+bec[n-1]),bec[n-1],vec[0]})<<endl;
}
}