#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &(n));
  string s;
  cin >> s;
  int ans = 0;
  int curside = s[0] == 'R' ? 2 : 1;
  int posx = s[0] == 'R' ? 1 : 0, posy = s[0] == 'R' ? 0 : 1;
  for (int i = (1); i < (n); i++) {
    if (s[i] == 'R') {
      posx++;
      if (curside == 1 && posx > posy) {
        ans++;
        curside = 2;
      }
    } else {
      posy++;
      if (curside == 2 && posy > posx) {
        ans++;
        curside = 1;
      }
    }
  }
  cout << ans << endl;
}
