#include <bits/stdc++.h>
using namespace std;
long long min(long long x, long long y) { return (x < y ? x : y); }
long long max(long long x, long long y) { return (x > y ? x : y); }
int stoi(string s) { return atoi(s.c_str()); }
int keta(long long x) {
  if (x < 10) {
    return 1;
  } else {
    return keta(x / 10) + 1;
  }
}
int main() {
  int N;
  string s;
  cin >> N >> s;
  int r = 0;
  char t;
  int buf_b = 0;
  int buf_w = 0;
  for (int i = N - 1; i > -1; i--) {
    t = s[i];
    if (t == '.') {
      if (buf_b > 0) {
        if (buf_b < buf_w) {
          buf_w += (buf_b + 1);
          r += buf_b;
          buf_b = 0;
        } else {
          r += buf_w;
          buf_w = 0;
          buf_b = 0;
        }
      }
      buf_w++;
    } else {
      buf_b++;
    }
  }
  printf("%d\n", r);
}
