#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  string stones;
  cin >> n >> stones;
  bool bwhite = stones[0] == '.';
  vector<int> gr;
  int ng = 1;
  for (int i = 0; i < n; i++) {
    if (stones[i] == stones[i - 1]) {
      ng++;
    } else {
      gr.push_back(ng);
      ng = 1;
    }
  }
  int m = 0;
  if (bwhite) {
    for (int i = 1; i + 1 < gr.size(); i += 2) {
      m += min(gr[i], gr[i + 1]);
    }
  } else {
    for (int i = 0; i + 1 < gr.size(); i += 2) {
      m += min(gr[i], gr[i + 1]);
    }
  }
  cout << m << "\n";
  return 0;
}
