#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, f = 0;
  int x[4] = {0};
  cin >> n;
  char a[2000001];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    if (a[i] == 'U') x[0]++;
    if (a[i] == 'D') x[1]++;
    if (a[i] == 'L') x[2]++;
    if (a[i] == 'R') x[3]++;
    if (x[0] >= 1 && x[1] >= 1 || x[2] >= 1 && x[3] >= 1) {
      f++;
      x[0] = 0;
      x[1] = 0;
      x[2] = 0;
      x[3] = 0;
      if (a[i] == 'U') x[0]++;
      if (a[i] == 'D') x[1]++;
      if (a[i] == 'L') x[2]++;
      if (a[i] == 'R') x[3]++;
    }
  }
  cout << f + 1;
}
