#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, d, ans;
  scanf("%d\n", &n);
  a = 0;
  b = 0;
  c = 0;
  d = 0;
  ans = 1;
  for (int i = 1; i <= n; i++) {
    char cc;
    cc = getchar();
    if (cc == 'U') a++;
    if (cc == 'D') b++;
    if (cc == 'L') c++;
    if (cc == 'R') d++;
    if ((a && b) || (c && d)) {
      ans++;
      a = 0;
      b = 0;
      c = 0;
      d = 0;
      if (cc == 'U') a++;
      if (cc == 'D') b++;
      if (cc == 'L') c++;
      if (cc == 'R') d++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
