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

int main(){

  int N; cin >> N;
  string S; cin >> S;

  int tmp0 = 0;
  int tmp1 = 0;
  int time = 0;


  for(int i = 0 ; i < N ; ++i){

    if(S[i] == '#' && S[i-1] == '.'){
      time += min(tmp0, tmp1);
      tmp0 = 0; tmp1 = 0;
    }

    if(S[i] == '#') tmp0++;
    if(S[i] == '.') tmp1++;
    // cout << tmp0 << "\t" << tmp1 << endl;

    if(i == N-1){
      time += min(tmp0, tmp1);
    }

    if(i == N-1 && S[i] == '.'){
      time -= tmp0;
      time += tmp1;

    }

  cout << time << endl;
  


}