#include <string>
#include <iostream>
using namespace std;
int main(){
  int n;cin>>n;
  string s;cin>>s;
  bool isS = false, isD = false;
  int r1=0,r2=0,r3=0;
  for(int i=n-1;i>=0;i--) {
    if (s.at(i) == '#') {
      r1++; isS = true;
      if (isD) r3++;
    } else if (isS) {
      r2++;
      isD = true;
    }
 }
  #cout << r1 << " " << r2 << " " << r3 << endl;
 cout << min(r3,min(r1,r2)) << endl;
}
    