#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  string s;
  cin >> N >> s;
  vector<long long> vec;
  char prev = s[0];
  long long len = 1;
  for (long long i = 1; i < N; ++i) {
    if (prev == s[i]) {
      ++len;
    } else {
      prev = s[i];
      vec.push_back(len);
      len = 1;
    }
  }
  vec.push_back(len);
  long long ans0 = 0;
  long long ans1 = 0;
  for (int i = 0; i < vec.size(); ++i) {
    if ((i % 2) == 0) {
      ans0 += vec[i];
    } else {
      ans1 += vec[i];
    }
  }
  long long start = 0;
  if (s[0] == '.') {
    start = 1;
  }
  long long ans = 0;
  long long size = vec.size();
  long long kuro = 0;
  for (long long i = start; i < size; i = i + 2) {
    if (i == size - 1) {
      break;
    }
    if (vec[i] > vec[i + 1]) {
      ans += vec[i + 1];
      kuro += vec[i] + vec[i + 1];
    } else {
      if (i == 0) {
        ans += vec[i];
      } else {
        if (vec[i + 1] >= vec[i] + kuro) {
          ans += vec[i] + kuro;
          kuro = 0;
        } else {
          ans += vec[i + 1];
          kuro += vec[i] + vec[i + 1];
        }
      }
    }
  }
  ans = min(ans, ans0);
  ans = min(ans, ans1);
  cout << ans << endl;
}
