#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  S = S + '#';
  vector<int> a(S.size(), 0);
  int i, j, J;
  int b;
  char c = S.at(0);
  for (i = j = 0; i < S.size(); i++) {
    if (S.at(i) != c) {
      c = S.at(i);
      j++;
    }
    if (c == '.')
      a.at(j)++;
    else
      a.at(j)--;
  }
  J = j + 1;
  b = 0;
  for (i = 0; i < J; i++) {
    if (a.at(i) > 0) b += a.at(i);
  }
  if (a.at(0) < 0) {
    i = 0;
  } else {
    i = 1;
    b -= a.at(0);
  }
  int B = b;
  for (; i < J; i += 2) {
    b = b - a.at(i) - a.at(i + 1);
    B = min(B, b);
  }
  cout << B << endl;
}
