#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  char s[n];
  for (int i = 0; i < n; i++) cin >> s[i];
  int cntw = 0, cntb = 0, w[n], b[n];
  for (int i = 0; i < n; i++) {
    if (s[i] == '.')
      cntw++;
    else
      cntb++;
    w[i] = cntw;
    b[i] = cntb;
  }
  if (cntw == 0 || cntb == 0) {
    cout << "0" << endl;
    return 1;
  }
  int ans = 2 * 100000;
  for (int i = 0; i < n - 1; i++) {
    int tmpw = 0, tmpb = 0, tmp = -1;
    if (s[i] == '#') {
      tmpw = w[n - 1] - w[i];
      tmpb = b[n - 1] - b[i];
      if (tmpw == 0)
        tmp = 0;
      else if (tmpw == n - i)
        tmp = 1;
      else {
        tmp = tmpw;
      }
      if (tmp != -1) ans = min(ans, tmp);
      break;
    }
  }
  cout << ans << endl;
}
