#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  string s;
  int b = 0;
  int w = 0;
  int sum = 0;
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      sum += (b < w) ? b : w;
      b += 1;
      w = 0;
    } else {
      w += 1;
    }
  }
  sum += (b < w) ? b : w;
  cout << sum;
}
