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

int main(){
    int N;
    string str;
    cin >> N >> str;

    int count_black = 0;
    int count_1st = 0;
    int count_last = 0;
    bool flag = true;

    for(int i = 0;i < N;i++){
      //黒の数を数える
      if(str.substr(i,1) == "#"){
        count_black++;
        //初めて黒になったところを調べる
        if(flag == true){
          count_1st = i;
          flag = false;
        }
    }
    }
    //黒が続く回数を調べる
  reverse(str.begin(),str.end());
    for(int i = 0;i < N;i++){
      if(str.substr(i,1) == "#")count_last++;
      else break;
    }

    int count_min = min(N - count_black - count_1st,
                        count_black - count_last,
                        count_black,N - count_black);
    cout << count_min << endl;
}
