#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  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) {
    nums.push_back(cnt);
  }
  int temp = 0;
  if (cnt > 0) {
    for (int i = 1; i < nums.size(); i += 2) {
      ans += nums.at(i);
    }
    bool isEven = nums.size() % 2 == 0;
    if (isEven) {
      for (int i = 0; i < nums.size() - 2; i += 2) {
        temp += nums.at(i);
      }
      temp += nums.at(nums.size() - 1);
    } else {
      for (int i = 0; i < nums.size() - 1; i += 2) {
        temp += nums.at(i);
      }
      ans = min(ans, temp);
      temp = 0;
      for (int i = 1; i < nums.size(); i += 2) {
        temp += nums.at(i);
      }
      ans = min(ans, temp);
    }
  }
  ans = min(ans, temp);
  cout << ans << endl;
  return 0;
}
