#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long int inverse(long long int i) {
  if (i == 1) return 1;
  return (MOD - ((MOD / i) * inverse(MOD % i)) % MOD + MOD) % MOD;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long x = 0, y = 0, ans = 0, len = 0, last;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s[i] == 'U')
      y++;
    else if (s[i] == 'D')
      y--;
    else if (s[i] == 'R')
      x++;
    else
      x--;
    len++;
    if (len > (abs(x) + abs(y))) {
      x = 0;
      y = 0;
      len = 0;
      ans++;
      i--;
      last = i;
    }
  }
  if (last != (n - 1)) ans++;
  cout << ans;
}
