#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, ans = 0;
  cin >> n;
  string s;
  cin >> s;
  int help[4] = {0}, flag = 0;
  if (s[0] == 'R')
    help[0] = 1;
  else if (s[0] == 'L')
    help[1] = 1;
  else if (s[0] == 'U')
    help[2] = 1;
  else if (s[0] == 'D')
    help[3] = 1;
  for (i = 1; i < s.length(); i++) {
    if (s[i] == 'R' && help[1] == 1) {
      ans++;
      help[0] = 1;
      help[1] = help[2] = help[3] = 0;
    } else if (s[i] == 'L' && help[0] == 1) {
      ans++;
      help[1] = 1;
      help[0] = help[2] = help[3] = 0;
    } else if (s[i] == 'U' && help[3] == 1) {
      ans++;
      help[2] = 1;
      help[0] = help[1] = help[3] = 0;
    } else if (s[i] == 'D' && help[2] == 1) {
      ans++;
      help[3] = 1;
      help[0] = help[1] = help[2] = 0;
    } else {
      if (s[i] == 'R')
        help[0] = 1;
      else if (s[i] == 'L')
        help[1] = 1;
      else if (s[i] == 'U')
        help[2] = 1;
      else
        help[3] = 1;
      flag = 1;
    }
  }
  cout << ans + 1;
  return 0;
}
