#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long n;
  string s;
  cin >> n >> s;
  long x = 0, y = 0;
  long d = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'R')
      ++x;
    else
      ++y;
    if ((x == y) && (i < n - 1) && (s[i + 1] == s[i])) ++d;
  }
  cout << d;
}
