#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int x = 0, y = 0, lastx = 0, lasty = 0, path = 0, count = 0, ax = 0, ay = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'L') x--;
    if (s[i] == 'R') x++;
    if (s[i] == 'U') y++;
    if (s[i] == 'D') y--;
    if (i == n - 1) {
      count++;
    }
    path++;
    int min = abs(x - ax) + abs(y - ay);
    if (path > min) {
      count++;
      ax = lastx;
      ay = lasty;
      path = 1;
    }
    lastx = x;
    lasty = y;
  }
  cout << count;
  return 0;
}
