#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  long long a = 0, b = 0;
  bool flg = false;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      flg = true;
    }
    if (flg && s[i] == '#') a++;
    if (flg && s[i] == '.') b++;
  }
  long long cnt = 0;
  if (s[n - 1] == '#') {
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] == '.') break;
      cnt++;
    }
  }
  a -= cnt;
  cout << min({a, b, cnt}) << endl;
}
