#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
const long long LINF = 1e11;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  int w = 0;
  int b = 0;
  bool f = true;
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == '.') {
      w++;
    } else {
      b++;
    }
    if (i == 0 || s[i] != s[i - 1]) {
      if (f) {
        f = false;
        continue;
      } else {
        if (w <= b) {
          ans += w;
          w = 0;
          b = 0;
        } else {
          ans += b;
          w += b;
          b = 0;
        }
        f = true;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
