#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << (a) << endl;
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << " ";
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << " ";
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << " ";
  pr(b, c, d);
}
int main(void) {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> v;
  if (n == 1) {
    pr(0);
    return 0;
  }
  if (s[0] == '#') v.push_back(0);
  int tmp = 0;
  int rw = 0;
  for (int i = 1; i < n; i++) {
    tmp++;
    if (s[i - 1] != s[i]) {
      v.push_back(tmp);
      if (v.size() % 2) rw += tmp;
      tmp = 0;
    }
  }
  v.push_back(++tmp);
  if (v.size() % 2) rw += tmp;
  if (s[s.size() - 1] == '#') v.push_back(0);
  int lb = 0;
  vector<int> ans;
  for (int i = 0; i < int(v.size() - 1); ++i) {
    if (i % 2) {
      continue;
    }
    lb += v[i];
    rw -= v[i];
    ans.push_back(lb + rw);
  }
  sort(ans.begin(), ans.end());
  pr(ans.size() == 0 ? 0 : ans[0]);
}
