#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  string t = s;
  vector<pair<int, char>> comps;
  int curr = 1;
  for (int i = 1; i < n; i++) {
    if (s[i] != s[i - 1]) {
      comps.push_back({curr, s[i - 1]});
      curr = 0;
    }
    curr++;
  }
  comps.push_back({curr, s[n - 1]});
  int cnt = 0;
  for (int i = 0; i < comps.size() - 1; i++) {
    if (comps[i].second == '#' && comps[i + 1].second == '.') {
      int opt1, opt2;
      opt1 = opt2 = 0;
      if (comps[i].first < comps[i + 1].first) {
        cnt += comps[i].first;
        comps[i].second = '#';
      } else {
        cnt += comps[i + 1].first;
        comps[i + 1].second = '.';
      }
    }
  }
  cout << cnt << "\n";
}
