#include <bits/stdc++.h>
using namespace std;
int used[4];
void clrusd(void) { used[0] = used[1] = used[2] = used[3] = 0; }
int main() {
  int n;
  int res = 1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    if (c == 'U')
      if (used[1])
        res++, clrusd(), used[0] = 1;
      else
        used[0] = 1;
    else if (c == 'D')
      if (used[0])
        res++, clrusd(), used[1] = 1;
      else
        used[1] = 1;
    else if (c == 'R')
      if (used[3])
        res++, clrusd(), used[2] = 1;
      else
        used[2] = 1;
    else if (used[2])
      res++, clrusd(), used[3] = 1;
    else
      used[3] = 1;
  }
  cout << res;
  return 0;
}
