#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int sum = 0;
  int a = 0;
  int b = 0;
  int i = 0;
  while (i < n) {
    while (s.at(i) == '#') {
      a += 1;
      i++;
      if (i >= n) {
        break;
      }
    }
    while (i < n and s.at(i) == '.') {
      b += 1;
      i++;
      if (i >= n) {
        break;
      }
    }
    if (a > 0 and b > 0) {
      sum += min(a, b);
    }
    a = 0;
    b = 0;
  }
  cout << sum << endl;
  ;
}
