#include <bits/stdc++.h>
using namespace std;
string mov;
int main() {
  int n;
  int cnt = 0, x = 0, y = 0;
  bool fl = 0;
  bool po = 0;
  cin >> n >> mov;
  if (mov[0] == 'R')
    x++;
  else
    y++;
  for (int i = 1; i < mov.length(); i++) {
    if (x == y)
      if (mov[i] == mov[i - 1]) cnt++;
    if (mov[i] == 'R')
      x++;
    else
      y++;
  }
  cout << cnt << endl;
  return 0;
}
