#include <bits/stdc++.h>
using namespace std;
int Result_int;
long Result_lng;
string Result_str = "";
long long N, left, t;
string S;
int main() {
  long long r_white = 0, r_black = 0, n;
  long long ignore_white = 0, ignore_black = 0;
  long left_b, right_w;
  char white = '.';
  char black = '#';
  cin >> N;
  cin >> S;
  for (long long i = 0; i < (N); i++) {
    if (S[i] == white) {
      r_white++;
    } else {
      r_black++;
    }
  }
  right_w = r_white;
  Result_lng = min(r_white, r_black);
  for (long long i = 0; i < (N); i++) {
    if (S[i] == white) {
      right_w--;
    } else {
      left_b++;
      if (left_b + right_w > Result_lng) {
        cout << Result_lng << endl;
        break;
      } else {
        Result_lng = left_b + right_w;
      }
    }
  }
}
