#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
__attribute__((constructor)) void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int leftB[200001] = {0};
int rightW[200001] = {0};
int main() {
  int N;
  string S;
  cin >> N >> S;
  long long sumB = 0;
  for (int i = 0; i < (N); i++) {
    leftB[i] = sumB;
    if (S[i] == '#') sumB++;
  }
  long long sumW = 0;
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] == '.') sumW++;
    rightW[i] = sumW;
  }
  long long minResult = 1145141919;
  char preC = '@';
  bool hasIF = false;
  for (int i = 0; i < (N); i++) {
    if (preC != '@' && S[i] != preC) {
      long long currentResult = leftB[i] + rightW[i];
      minResult = min(minResult, currentResult);
      hasIF = true;
    }
    preC = S[i];
  }
  if (!hasIF) minResult = 0;
  cout << minResult << endl;
}
