#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k, tempb = 0, tempw = 0, switchh = 0;
  long long ans = 0;
  bool flg = false;
  cin >> n;
  string s;
  cin >> s;
  i = 0;
  while (i < n) {
    if (s[i] == '#')
      tempb++;
    else
      tempw++;
    if (i < n - 1) {
      if (s[i] != s[i + 1]) {
        switchh++;
      }
    } else {
      switchh++;
    }
    if (switchh >= 2) {
      ans += min(tempb, tempw);
      tempb = 0;
      tempw = 0;
      switchh = 0;
    }
    i++;
  }
  if (ans == 0) ans = min(tempb, tempw);
  cout << ans << endl;
  return 0;
}
