#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const long long maxn = 1e5 + 10;
inline long long dist(long long x, long long y, long long x2, long long y2) {
  return abs(x - x2) + abs(y - y2);
}
long long res;
int32_t main() {
  long long n = in();
  string s;
  cin >> s;
  pair<long long, long long> location = {0, 0};
  long long x = 0, y = 0;
  long long pre = -1;
  for (long long i = 0; i < s.size(); i++) {
    pair<long long, long long> now = {x, y};
    if (s[i] == 'L' || s[i] == 'R')
      y += s[i] == 'L' ? -1 : 1;
    else
      x += s[i] == 'U' ? 1 : -1;
    if (dist(location.first, location.second, x, y) != i - pre) {
      res++;
      location = now;
      pre = i - 1;
    }
  }
  cout << res + 1 << endl;
}
