#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  bool blackflag = true;
  vector<int> black(n);
  vector<int> white(n);
  int pbitr = 0;
  int pwitr = 0;
  for (int64_t i = 0; i < (int64_t)(n); i++) {
    if (blackflag) {
      if (s.at(i) == '#') {
        black.at(pbitr)++;
      } else {
        pbitr++;
        white.at(pwitr) = 1;
        blackflag = !blackflag;
      }
    } else {
      if (s.at(i) == '.') {
        white.at(pbitr)++;
      } else {
        pwitr++;
        black.at(pbitr) = 1;
        blackflag = !blackflag;
      }
    }
  }
  int64_t total = 0;
  for (int64_t i = 0; i < (int64_t)(n); i++) {
    total += min(white.at(i), black.at(i));
  }
  cout << total << endl;
}
