#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  char updown = ' ', rightleft = ' ';
  int n;
  int i, dir, cur, ct = 1;
  cin >> n;
  cin >> s;
  if (s[0] == 'U' || s[0] == 'D') {
    updown = s[0];
  } else
    rightleft = s[0];
  for (i = 1; i < n; ++i) {
    if (updown == ' ' && (s[i] == 'U' || s[i] == 'D'))
      updown = s[i];
    else if (rightleft == ' ' && (s[i] == 'R' || s[i] == 'L'))
      rightleft = s[i];
    else if ((s[i] == 'U' || s[i] == 'D') && s[i] != updown) {
      updown = s[i];
      rightleft = ' ';
      ct++;
    } else if ((s[i] == 'R' || s[i] == 'L') && s[i] != rightleft) {
      rightleft = s[i];
      updown = ' ';
      ct++;
    }
  }
  cout << ct;
  return 0;
}
