#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
int n;
string s;
void input() {
  cin >> n;
  cin >> s;
  return;
}
int count() {
  vector<int> a(n);
  vector<int> b(n);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      if (s[i] == '.') {
        a[0] = 1;
        b[0] = 0;
      } else {
        a[0] = 0;
        b[0] = 1;
      }
    } else {
      if (s[i] == '.') {
        a[i] = a[i - 1] + 1;
        b[i] = b[i - 1];
      } else {
        a[i] = a[i - 1];
        b[i] = b[i - 1] + 1;
      }
    }
  }
  for (int i = 1; i < n; i++) {
    if (s[i] != s[i - 1]) {
      cnt += min(b[i], a[n - 1] - a[i]);
    }
  }
  return cnt;
}
int main(void) {
  input();
  int ans = count();
  printf("%d\n", ans);
  return 0;
}
