166
rbbbbbbbbbbbbrbrrbbrbbbrbbbbbbbbbbrbbbbbbrbbbrbbbbbrbbbbbbbrbbbbbbbrbbrbbbbbbbbrbbbbbbbbbbbbbbrrbbbrbbbbbbbbbbbbbbrbrbbbbbbbbbbbrbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbb
 7
rrbrbrb
 1
r
 2
bb
 18
rrrrrrrrrrrrrrrrrb
 8
rbbrbrbr
 1
b
 13
rbbbrbrrbrrbb
 100
brbbbrrrbbrbrbbrbbrbbbbrbbrrbbbrrbbbbrbrbbbbbbbbbbbbbbbbrrrrbbbbrrrbbbbbbbrbrrbrbbbbrrrbbbbrbbrbbbrb
 2
rb
 2
rr
 2
br

70
 1
 0
 1
 8
 1
 0
 3
 34
 0
 1
 0

#include <bits/stdc++.h>
int dir1[] = {0, 0, 1, -1};
int dir2[] = {1, -1, 0, 0};
int dir3[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dir4[] = {-1, 1, -1, 0, 1, -1, 0, 1};
template <class T>
T power(T a, T b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 1)
    return a * power(a, b - 1);
  else {
    T k = power(a, b / 2);
    return k * k;
  }
}
template <class T>
T find(T node, T parent[]) {
  return parent[node] =
             (parent[node] == node) ? node : find(parent[node], parent);
}
template <class T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <class T>
T sqr(T a) {
  return a * a;
}
template <class T>
int set_bit(T N, T pos) {
  return N = N | (1 << pos);
}
template <class T>
bool check_bit(T N, T pos) {
  return N & (1 << pos);
}
template <class T>
int reset_bit(T N, T pos) {
  return N = N & ~(1 << pos);
}
using namespace std;
int main() {
  int n;
  while (1 == scanf("%d", &n)) {
    char s[n + 5];
    int arr[n + 5];
    scanf("%s", s);
    int ans = 0;
    bool f = true;
    while (f) {
      f = false;
      for (int i = 1; i < n - 2; i++) {
        if (s[i] == s[i - 1] && s[i + 1] == s[i + 2] && s[i] != s[i + 1]) {
          swap(s[i], s[i + 1]);
          ans++;
          f = true;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      if (i && s[i] == s[i - 1])
        arr[i] = arr[i - 1] + 1;
      else
        arr[i] = 1;
    }
    for (int i = 0; i < n - 1; i++)
      if (arr[i] < arr[i + 1]) arr[i] = 0;
    for (int i = 0; i < n; i++) ans += arr[i] / 2;
    printf("%d\n", ans);
  }
  return 0;
}
