#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int output = 0;
  int index = 0;
  while (index < N) {
    int b = 0, w = 0;
    while (S[index] == '#') {
      b++;
      index++;
    }
    while (S[index] == '.') {
      w++;
      index++;
    }
    output += min(b, w);
  }
  cout << output << endl;
  return 0;
}
