#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  string s;
  cin >> n >> s;
  long long sum1 = 0;
  long long sum2 = 0;
  for (long long i = 0; i < n - 1; i++) {
    if (s[i] == '#') {
      sum1++;
    } else {
      sum2++;
    }
  }
  if (s[n - 1] == '.') {
    sum2++;
  }
  long long sum3 = sum1;
  for (long long i = n - 1; i >= 0; i--) {
    if (s[i] == '#') {
      sum1--;
    } else {
      if (sum3 - sum1 > 0) {
        sum1++;
      }
      break;
    }
  }
  if (s[0] == '#') {
    if (min(sum1, sum2) >= 0) {
      cout << min(sum1, sum2) << endl;
    } else {
      cout << 0 << endl;
    }
  } else {
    if (min(sum1, sum2 - 1) >= 0) {
      cout << min(sum1, sum2 - 1) << endl;
    } else {
      cout << 0 << endl;
    }
  }
}
