#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p = -1, x = 0, m = 0, q = -1, y = 0, l = 0;
  string s;
  cin >> n >> s;
  vector<bool> u(n);
  for (int a = 0; a < n; a++) {
    if (s[a] == '.') {
      u[a] = true;
      if (p != -1) {
        y++;
        q = a;
      }
    } else {
      u[a] = false;
      if (p == -1) {
        p = a;
        x++;
      } else if (q == -1) {
        x++;
      } else {
        if (x < y) {
          l += x;
          y = 0;
          x = 0;
          p = -1;
          q = -1;
        } else {
          x += y + 1;
          m += y;
          y = 0;
          p = -1;
        }
      }
    }
  }
  if (p != -1 && q != -1) {
    if (x < y) {
      l += x;
    } else {
      m += y;
    }
  }
  cout << l + m;
  return 0;
}
