#include <bits/stdc++.h>
using namespace std;
int n, t1, t2, ans, dB[1000001], dW[1000001];
char x;
int main() {
  int i, j, te1, te2;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (x == '.') {
      dW[i] = dW[i - 1] + 1;
      dB[i] = dB[i - 1];
    } else {
      dB[i] = dB[i - 1] + 1;
      dW[i] = dW[i - 1];
    }
  }
  for (i = 1; i <= n; i++) {
    if (dW[i] == dW[i - 1] + 1) {
      t1 = dB[i];
      t2 = dW[n] - dW[i - 1];
      if (t1 == 0 || t2 == 0) {
        cout << 0;
        return 0;
      }
      cout << t1 << " " << t2 << endl;
      if (t1 <= t2) {
        for (j = 0; j < i; j++) {
          dW[j] = j;
          dB[j] = 0;
        }
        te1 = dB[i];
        te2 = dW[i];
        for (j = i; j <= n; j++) {
          dB[j] -= te1;
          dW[j] = dW[j] - te2 + i;
        }
      }
      if (t1 > t2) {
        for (j = i; j <= n; j++) {
          dW[j] = dW[i];
          dB[j] = dB[j - 1] + 1;
        }
      }
      ans += min(t1, t2);
    }
  }
  cout << ans;
  return 0;
}
