#include <bits/stdc++.h>
using namespace std;
template <class T>
T* serchL(T* begin, T* end, T num) {
  T* p = begin;
  for (; p < end; p++) {
    if (&p >= num) {
      return p;
    }
  }
  return NULL;
}
int execute(int& N, string& S) {
  int ans = 0;
  vector<int> stone;
  char prev = '.';
  int cnt = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) != prev) {
      prev = S.at(i);
      stone.push_back(cnt);
      cnt = 1;
    } else {
      cnt++;
    }
  }
  stone.push_back(cnt);
  if (stone.size() == 1) {
    cout << "0\n";
    return 0;
  }
  int i = stone.size() - 1;
  if (i % 2) {
    i--;
  }
  int siro = 0, kuro = 0;
  for (; i > 0; i--) {
    if (i % 2) {
      kuro += stone[i];
    } else {
      siro += stone[i];
    }
  }
  cout << min(kuro, siro) << "\n";
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  int N = 7;
  string S = "#######";
  cin >> N >> S;
  execute(N, S);
  return 0;
}
