#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  string S;
  vector<long long> v, w;
  long long t = 0;
  cin >> N;
  cin >> S;
  v.push_back(0);
  for (auto i = (S.begin()); i != (S.end()); i++) {
    if (*i != '.') {
      v.push_back(t);
      while (i != S.end() && *i != '.') {
        i++;
      }
      if (i == S.end()) {
        break;
      }
    }
    t++;
  }
  if (t != v.back()) {
    v.push_back(t);
  }
  t = 0;
  w.push_back(0);
  for (auto i = (S.rbegin()); i != (S.rend()); i++) {
    if (*i != '#') {
      w.push_back(t);
      while (i != S.rend() && *i != '#') {
        i++;
      }
      if (i == S.rend()) {
        break;
      }
    }
    t++;
  }
  if (t != w.back()) {
    w.push_back(t);
  }
  long long sum = 1000000;
  auto i = v.begin();
  auto j = w.rbegin();
  for (; i != v.end(); i++, j++) {
    if (*i + *j < sum) {
      sum = *i + *j;
    }
  }
  cout << sum << endl;
  return 0;
}
