#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, le, g = 0;
  char str[200005];
  scanf("%d", &n);
  scanf("%s", str);
  int x = 0, y = 0, x1 = 0, y1 = 0, cnt = 0, p1, p2;
  for (i = 0; i < strlen(str); i++) {
    if (str[i] == 'R') x++;
    if (str[i] == 'U') y++;
    if (str[i] == 'L') x--;
    if (str[i] == 'D') y--;
    g++;
    le = abs(x - x1) + abs(y - y1);
    if (le < g) {
      g = 0;
      x1 = p1;
      y1 = p2;
      cnt++;
    }
    p1 = x, p2 = y;
  }
  printf("%d\n", cnt + 1);
}
