#include <bits/stdc++.h>
using namespace std;
int AbsDifference(int a, int b) {
  if (a >= b) return a - b;
  return b - a;
}
long long AbsDifference(long long a, long long b) {
  if (a >= b) return a - b;
  return b - a;
}
const int mod = 1000000007;
const int mod2 = 1000000009;
const int inf = 1 << 30;
const long long infLL = 1ll << 62;
const int impossible = -1;
struct stoyan_point {
  int x, y;
  int id;
};
struct stoyan_pointLL {
  long long x, y;
  int id;
};
struct stoyan_segment {
  stoyan_point first, second;
  int lenght;
  bool type;
  int id;
};
struct stoyan_segmentLL {
  stoyan_pointLL first, second;
  long long lenght;
  bool type;
  int id;
};
string translate(int number, int lenght, int k) {
  string ans;
  while (number) {
    ans += char(('1') + number & 1);
    number >>= 1;
  }
  reverse(ans.begin(), ans.end());
  return ans;
}
vector<int> find_divisors(long long number) {
  vector<int> ans;
  int sq = sqrt(number), j;
  for (j = 1; j <= sq; j++) {
    if (number % j == 0) {
      ans.push_back(j);
      if (j * j != number) ans.push_back(number / j);
    }
  }
  sort(ans.begin(), ans.end());
  return ans;
}
int cnt_divisors(long long number) {
  int ans = 0;
  int sq = sqrt(number), j;
  for (j = 1; j <= sq; j++) {
    if (number % j == 0) {
      ans++;
      if (j * j != number) ans++;
    }
  }
  return ans;
}
int n;
string s;
int x, y;
int where_last = 0;
int AnswerProblem;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  cin >> s;
  for (int i = 0; i < int(s.size()); i++) {
    if (s[i] == 'R')
      x++;
    else
      y++;
    if (y > x) {
      if (where_last == -1) {
        AnswerProblem++;
      }
      where_last = 1;
    }
    if (y < x) {
      if (where_last == 1) {
        AnswerProblem++;
      }
      where_last = -1;
    }
  }
  cout << AnswerProblem << endl;
  return 0;
}
