#include <bits/stdc++.h>
using namespace std;
template <typename T = int>
T in() {
  T temp;
  cin >> temp;
  return temp;
}
template <typename VType = int>
list<VType> const LR(VType start, VType end) {
  list<VType> ret;
  for (VType i = start; i < end; i++) ret.push_back(i);
  return move(ret);
}
void change(char& c) {
  if (c == '#')
    c = '.';
  else
    c = '#';
}
int main() {
  int N(in());
  auto S(in<string>());
  int count = 0;
  char prev;
  bool cont = false;
  for (int i = 0; i < N; i++) {
    if (0 < i) {
      if (prev != S[i]) {
        if (!cont || (i == N - 1)) {
          change(S[i]);
          count++;
        } else {
          cont = false;
        }
      } else {
        cont = true;
      }
    }
    prev = S[i];
  }
  cout << count << endl;
  return 0;
}
