#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  char path[1000005];
  cin >> path;
  int x = 0, y = 0;
  int xi = 0, yi = 0;
  int steps = 0;
  int count = 0;
  for (int i = 0; i < n; i++) {
    steps++;
    int r = x, m = y;
    if (path[i] == 'R') {
      x++;
    } else if (path[i] == 'L') {
      x--;
    } else if (path[i] == 'D') {
      y--;
    } else if (path[i] == 'U') {
      y++;
    }
    if (steps > abs(xi - x) + abs(yi - y)) {
      xi = r;
      yi = m;
      count++;
      steps = 1;
    }
  }
  cout << count + 1;
  return 0;
}
