#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int i = 0;
  int ans = 0;
  while (s[i] == '.') i++;
  while (i < s.size()) {
    int c = 0;
    while (s[i] == '#') {
      i++;
      c++;
    }
    int c2 = 0;
    while (s[i] == '.') {
      i++;
      c2++;
    }
    ans += min(c, c2);
  }
  cout << ans << endl;
}
