#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 (s[i] == '#') {
          b[bj]++;
          i++;
        } else {
          bj++;
          break;
        }
      }
    }
    if (s[i] == '.') {
      while (1) {
        if (s[i] == '.') {
          i++;
          w[wj]++;
        } else {
          wj++;
          break;
        }
      }
    }
  }
  bool flag = false;
  for (long long i = 0; i < n; i++) {
    if (b[i] == 0 && w[i] == 0) break;
    if (flag) {
      if (b[i + 1] == 0 && w[i + 1] == 0) {
        res += min(b[i], w[i]);
      } else {
        res += w[i];
      }
    } else if (b[i] < w[i]) {
      res += b[i];
    } else {
      res += w[i];
      flag = true;
    }
  }
  cout << res << endl;
}
