#include <bits/stdc++.h>
using namespace std;
char s[2 * 100005];
int flog[5];
int main() {
  int n;
  cin >> n;
  cin >> s;
  int ans = 0;
  memset(flog, 0, sizeof(flog));
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R') {
      if (flog[4]) {
        ans++;
        memset(flog, 0, sizeof(flog));
      }
      flog[3] = 1;
    }
    if (s[i] == 'L') {
      if (flog[3] == 1) {
        ans++;
        memset(flog, 0, sizeof(flog));
      }
      flog[4] = 1;
    }
    if (s[i] == 'U') {
      if (flog[2] == 1) {
        ans++;
        memset(flog, 0, sizeof(flog));
      }
      flog[1] = 1;
    }
    if (s[i] == 'D') {
      if (flog[1] == 1) {
        ans++;
        memset(flog, 0, sizeof(flog));
      }
      flog[2] = 1;
    }
  }
  cout << ans + 1 << endl;
  return 0;
}
