#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 100;
const int inf = 0x3f3f3f3f;
const int SZ = 1 << 20;
struct fastio {
  char inbuf[SZ];
  char outbuf[SZ];
  fastio() {
    setvbuf(stdin, inbuf, _IOFBF, SZ);
    setvbuf(stdout, outbuf, _IOFBF, SZ);
  }
} io;
void read(int &x) {
  x = 0;
  char ch, c = getchar();
  while (c < '0' || c > '9') ch = c, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  if (ch == '-') x = -x;
}
char s[maxn];
int b[maxn], w[maxn];
vector<int> bb, ww;
int main() {
  int n;
  scanf("%d %s", &n, s + 1);
  long long ans = 0x3f3f3f3f;
  for (int i = 1; i <= n; i++) {
    b[i] = b[i - 1];
    w[i] = w[i - 1];
    if (s[i] == '.') {
      w[i]++;
      ww.push_back(i);
    } else {
      b[i]++;
      bb.push_back(i);
    }
  }
  long long temp;
  int pos;
  for (int i = 1; i <= n; i++) {
    temp = 0;
    if (s[i] == '.') {
      temp += b[i];
      pos = lower_bound(bb.begin(), bb.end(), i) - bb.begin();
      if (pos < bb.size()) temp = temp + w[n] - w[bb[pos] - 1];
    } else {
      temp = temp + w[n] - w[i - 1];
      pos = lower_bound(ww.begin(), ww.end(), i) - ww.begin();
      if (pos != 0) {
        pos--;
        temp = temp + b[ww[pos]];
      }
    }
    ans = min(ans, temp);
  }
  printf("%lld\n", ans);
  return 0;
}
