#include <bits/stdc++.h>
using namespace std;
;
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  int x = 0, y = 0;
  int res = 0;
  int x0 = 0, y0 = 0;
  for (int i = 0; i < n; i++) {
    if (str[i] == 'R') x0++;
    if (str[i] == 'L') x0--;
    if (str[i] == 'U') y0++;
    if (str[i] == 'D') y0--;
  }
  reverse(str.begin(), str.end());
  for (int i = 0; i < n; i++) {
    if (str[i] == 'L')
      str[i] = 'R';
    else if (str[i] == 'R')
      str[i] = 'L';
    else if (str[i] == 'U')
      str[i] = 'D';
    else if (str[i] == 'D')
      str[i] = 'U';
  }
  x = x0, y = y0;
  int d = 0;
  for (int i = 0; i < n; i++) {
    int e = x, e1 = y;
    if (str[i] == 'R') x++;
    if (str[i] == 'L') x--;
    if (str[i] == 'U') y++;
    if (str[i] == 'D') y--;
    d++;
    if (abs(x0 - x) + abs(y0 - y) < d) {
      d = 0;
      res++;
      x0 = e;
      y0 = e1;
      x = e;
      y = e1;
      i--;
    }
  }
  cout << res + 1;
  return 0;
}
