#include <bits/stdc++.h>
using namespace std;
int main() {
  int N = 0;
  char S[1000000];
  int ANS = 1000000001;
  cin >> N;
  cin >> S;
  vector<int> SDATA(N);
  vector<int> KDATA(N);
  vector<int> henka(N);
  if (S[0] == '.') {
    SDATA[0] = 1;
  } else {
    KDATA[0] = 1;
  }
  henka[0] = 0;
  for (int i = 1; i < N; i++) {
    if (S[i] == '.') {
      SDATA[i] = 1 + SDATA[i - 1];
      KDATA[i] = KDATA[i - 1];
    } else {
      SDATA[i] = SDATA[i - 1];
      KDATA[i] = 1 + KDATA[i - 1];
    }
    if (S[i] != S[i - 1]) {
      henka[i - 1] = 1;
    }
  }
  for (int i = 0; i < N; i++) {
    int BUF = 1000000001;
    if (henka[i] == 1) {
      if (SDATA[i] >= KDATA[i]) {
        if (SDATA[N - 1] - SDATA[i] <= KDATA[N - 1] - KDATA[i]) {
          BUF = KDATA[i] + SDATA[N - 1] - SDATA[i];
        } else {
          BUF = KDATA[i] + KDATA[N - 1] - KDATA[i];
        }
      } else {
        if (SDATA[N - 1] - SDATA[i] <= KDATA[N - 1] - KDATA[i]) {
          BUF = SDATA[i] + SDATA[N - 1] - SDATA[i];
        } else {
          BUF = ((KDATA[N - 1]) < (SDATA[N - 1]) ? (KDATA[N - 1])
                                                 : (SDATA[N - 1]));
        }
      }
    }
    ANS = ((ANS) < (BUF) ? (ANS) : (BUF));
  }
  cout << ANS << endl;
  return 0;
}
