#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s, sa;
  cin >> n >> s;
  vector<long long int> c(7);
  sa = "aa";
  s += sa;
  for (int i = 0; i < n; i++) {
    if (s.at(i) == '#' && s.at(i + 1) == '#') {
      c.at(4)++;
    }
    if (s.at(i) == '#' && s.at(i + 1) == '.') {
      c.at(2) += c.at(4) + 1;
    }
    if (s.at(i) == '.' && s.at(i + 1) == '#') {
      c.at(4) = 0;
    }
    if (s.at(i) == '#' && s.at(i + 1) == '.') {
      for (long long int j = i + 1; j < n; j++) {
        if (s.at(j) == '.') c.at(5)++;
        if (s.at(n - 1) == '.') {
          c.at(7) = min(c.at(5), c.at(4));
        } else
          c.at(2) += c.at(7);
        c.at(5) = 0;
        break;
      }
    }
  }
  long long int ans;
  ans = min(c.at(2), c.at(3)) + c.at(7);
  cout << ans << endl;
}
