#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long res = 0;
  long long b[n], w[n];
  memset(b, 0, sizeof(b));
  memset(w, 0, sizeof(w));
  long long bj = 0, wj = 0;
  for (long long i = 0; i < n;) {
    if (s[i] == '#') {
      while (1) {
        if (i >= n) break;
        if (s[i] == '#') {
          b[bj]++;
          i++;
        } else {
          bj++;
          break;
        }
      }
    }
    if (s[i] == '.') {
      while (1) {
        if (i >= n) break;
        if (s[i] == '.') {
          i++;
          w[wj]++;
        } else {
          wj++;
          break;
        }
      }
    }
  }
  long long sum = 0, sum2 = 0;
  long long k = max(wj, bj);
  bool flag = false;
  if (s[0] == '#') {
    for (long long i = k; i >= 0; i--) {
      sum += b[i];
    }
    for (long long i = k; i > 0; i--) {
      sum2 += w[i];
    }
    sum -= b[bj];
    sum2 += min(b[0], w[0]);
    res = min(sum, sum2);
  } else {
    for (long long i = k; i > 0; i--) {
      sum += w[i];
    }
    for (long long i = k; i >= 0; i--) {
      sum2 += b[i];
    }
    sum2 -= b[bj];
    res = min(sum, sum2);
  }
  cout << res << endl;
}
