#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int to = 0;
  int bl = 0;
  int wh = 0;
  vector<char> x(n);
  for (int i = 0; i < (int)(n); ++i) {
    cin >> x.at(i);
  }
  for (int i = 0; i < (int)(n - 1); ++i) {
    if (x.at(i) == '#') {
      bl++;
    }
    if (x.at(i) == '.') {
      wh++;
    }
    if (x.at(i) == '.' && x.at(i + 1) == '#') {
      to += min(bl, wh);
      bl = 0;
      wh = 0;
    }
  }
  if (x.at(n - 1) == '.') {
    wh++;
    to += min(bl, wh);
  }
  cout << to << endl;
}
