#include <bits/stdc++.h>
using namespace std;
int n, ans;
bitset<100> v;
inline int read() {
  char c = getchar();
  while (c != 'L' && c != 'R' && c != 'U' && c != 'D') c = getchar();
  return c;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    char c = read();
    v[c] = 1;
    if (v.count() > 2 || v['L'] && v['R'] || v['U'] && v['D']) {
      ans++;
      v.reset();
      v[c] = 1;
    }
  }
  printf("%d\n", ++ans);
  return 0;
}
