#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int rc = 0, uc = 0, c = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R')
      rc++;
    else
      uc++;
    if (rc == uc && s[i] == s[i + 1]) c++;
  }
  cout << c << "\n";
  return 0;
}
