#include <bits/stdc++.h>
using namespace std;
char l[200001];
int li[26];
int bit[200001];
char s1[1000];
char s2[1000];
int g1[26];
int g2[26];
int main() {
  int n, t, l, r;
  char ch;
  int j = 0;
  scanf("%d\n", &n);
  pair<int, int> point = make_pair(0, 0);
  pair<int, int> coords = make_pair(0, 0);
  pair<int, int> new_coords = make_pair(0, 0);
  int dist = 0;
  for (int i = 1; i <= n; i++) {
    dist++;
    t = getchar();
    if (t == 'R') {
      new_coords.second++;
    } else if (t == 'L') {
      new_coords.second--;
    } else if (t == 'U') {
      new_coords.first++;
    } else {
      new_coords.first--;
    }
    if (abs(new_coords.first - point.first) +
            abs(new_coords.second - point.second) <
        dist) {
      j++;
      point = coords;
      dist = 1;
    }
    coords = new_coords;
  }
  j++;
  printf("%d\n", j);
  return 0;
}
