#include <bits/stdc++.h>
using namespace std;
int N;
string S;
int main() {
  cin >> N >> S;
  int dot = 0, sharp = 0;
  int ans = 0;
  int j = 0;
  priority_queue<std::tuple<int, int, int, int> > que;
  bool done[10000];
  memset(done, 0, sizeof(done));
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    if (S[i] == '#') {
      if (dot != 0) {
        que.push(
            std::tuple<int, int, int, int>(min(sharp, dot), sharp, dot, j));
        dot = 0;
        sharp = 0;
        j++;
      }
      sharp++;
    }
    if (S[i] == '.') {
      dot++;
    }
  }
  que.push(std::tuple<int, int, int, int>(min(sharp, dot), sharp, dot, j));
  while (!que.empty()) {
    std::tuple<int, int, int, int> p = que.top();
    que.pop();
    if (done[get<3>(p)]) {
      ans += get<2>(p);
    } else {
      ans += get<0>(p);
    }
  }
  cout << ans << endl;
  return 0;
}
