#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> nums;
  char c = '#';
  int cnt = 0;
  for (int(i) = 0; (i) < (n); (i)++) {
    if (s.at(i) == c) {
      cnt++;
    }
    if (cnt > 0 && s.at(i) != c) {
      nums.push_back(cnt);
      cnt = 1;
      c = s.at(i);
    }
  }
  if (cnt > 0 && c != '#') {
    nums.push_back(cnt);
  }
  int temp = 0;
  int ans = INT_MAX;
  if (nums.size() != 0) {
    for (int i = 0; i < nums.size() - 1; i++) {
      for (int j = 0; j < i + 1; j += 2) {
        temp += nums.at(j);
      }
      for (int j = i + 1; j < nums.size() - 1; j++) {
        if (j % 2 == 1) {
          temp += nums.at(j);
        }
      }
      ans = min(ans, temp);
    }
  }
  ans = min(ans, temp);
  cout << ans << endl;
  return 0;
}
