#include <bits/stdc++.h>
int n;
char str[201000] = {0};
int main() {
  scanf("%d %s", &n, str);
  int i = 0, xdir = 0, ydir = 0, lines = 0;
  while (str[i]) {
    if (str[i] != 'L' && str[i] != 'R' && str[i] != 'D' && str[i] != 'U') {
      i++;
      continue;
    }
    if (str[i] == 'R') {
      if (xdir == -1) {
        xdir = 1;
        ydir = 0;
        lines++;
        i++;
        continue;
      } else {
        xdir = 1;
        i++;
        continue;
      }
    }
    if (str[i] == 'L') {
      if (xdir == 1) {
        xdir = -1;
        ydir = 0;
        lines++;
        i++;
        continue;
      } else {
        xdir = -1;
        i++;
        continue;
      }
    }
    if (str[i] == 'D') {
      if (ydir == 1) {
        xdir = 0;
        ydir = -1;
        lines++;
        i++;
        continue;
      } else {
        ydir = -1;
        i++;
        continue;
      }
    }
    if (str[i] == 'U') {
      if (ydir == -1) {
        xdir = 0;
        ydir = 1;
        lines++;
        i++;
        continue;
      } else {
        ydir = 1;
        i++;
        continue;
      }
    }
  }
  if (xdir != 0 || ydir != 0) lines++;
  printf("%d", lines);
  return 0;
}
