#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  string s;
  while (cin >> n >> s) {
    int i = 0, ans = 0;
    while (i < n && s[i] == '.') i++;
    for (; i < n; i++) {
      int b = 0;
      int w = 0;
      while (i < n && s[i] == '#') b++, i++;
      while (i < n && s[i] == '.') w++, i++;
      ans += min(b, w);
    }
    cout << ans << endl;
  }
  return 0;
}
