#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int x = 0, y = 0, steps = 0, i;
  int px = 0, py = 0, prevx = 0, prevy = 0, count = 0;
  for (i = 0; i < n; i++) {
    prevx = x;
    prevy = y;
    if (s[i] == 'R')
      x = x + 1;
    else if (s[i] == 'L')
      x = x - 1;
    else if (s[i] == 'U')
      y = y + 1;
    else if (s[i] == 'D')
      y = y - 1;
    if (abs(x - px) + abs(y - py) < steps) {
      count++;
      px = prevx;
      py = prevy;
      steps = 0;
    }
    steps++;
  }
  cout << count + 1;
}
