#include <bits/stdc++.h>
using namespace std;
map<char, int> m;
void cl() {
  m['L'] = 0;
  m['R'] = 0;
  m['U'] = 0;
  m['D'] = 0;
}
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 1;
  for (int i = 0; i < n; i++) {
    m[s[i]]++;
    int L = m['L'];
    int R = m['R'];
    int D = m['D'];
    int U = m['U'];
    if (s[i] == 'L') {
      if (R >= 1) {
        ans++;
        cl();
        m['L']++;
      }
    }
    if (s[i] == 'R') {
      if (L >= 1) {
        ans++;
        cl();
        m['R']++;
      }
    }
    if (s[i] == 'D') {
      if (U >= 1) {
        ans++;
        cl();
        m['D']++;
      }
    }
    if (s[i] == 'U') {
      if (D >= 1) {
        ans++;
        cl();
        m['U']++;
      }
    }
  }
  cout << ans;
  return 0;
}
