#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
template <typename T, typename T1>
T amax(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
using namespace std;
void solve() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  ll sum = 0;
  ll ans = 0;
  for (ll i = 0; i < n - 1; i++) {
    if (s[i] == 'R') {
      sum++;
    } else {
      sum--;
    }
    if (sum == 0 && s[i] == s[i + 1]) {
      ans++;
    }
  }
  cout << ans;
}
int main() {
  ll t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
