#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt = 1;
  char k;
  string s;
  cin >> n;
  cin >> s;
  vector<long long> a, b;
  while (s[0] == '.') s.erase(s.begin());
  while (s[s.length() - 1] == '#') s.erase(s.begin() + s.length() - 1);
  if (s.length()) {
    k = '#';
    for (int(i) = 1; (i) < (n); (i)++) {
      if (s[i] == k)
        cnt++;
      else {
        if (k == '#')
          a.push_back(cnt);
        else
          b.push_back(cnt);
        k = s[i];
        cnt = 1;
      }
      if (i == n - 1 && cnt > 1) {
        if (k == '#')
          a.push_back(cnt);
        else
          b.push_back(cnt);
      }
    }
    for (int(i) = 1; (i) < (a.size()); (i)++) a[i] += a[i - 1];
    for (int(i) = 1; (i) < (b.size()); (i)++) b[i] += b[i - 1];
    long long ans = min(a[a.size() - 1], b[b.size() - 1]);
    for (int(i) = 0; (i) < (a.size()); (i)++) {
      ans = min(ans, a[i] + b[b.size() - 1] - b[i]);
    }
    cout << ans << endl;
  } else
    cout << 0 << endl;
  return 0;
}
