#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  int white = 0, black = 0;
  bool isWhite = false, isBlack = false;
  int mini = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '#' && isWhite && isBlack) {
      mini += min(white, black);
      isWhite = false;
      white = 0;
      black = 1;
    } else if (s[i] == '.' && i == n - 1 && isBlack) {
      white++;
      mini += min(white, black);
    } else if (s[i] == '#') {
      isBlack = true;
      black++;
    } else if (s[i] == '.' && isBlack) {
      isWhite = true;
      white++;
    }
  }
  cout << mini << endl;
  return 0;
}
