#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  int x = 0, y = 0;
  int curx = 0, cury = 0, curi = 0, prevx = 0, prevy = 0;
  for (int i = 0; i < n; i++) {
    prevx = x;
    prevy = y;
    if (s[i] == 'R') x++;
    if (s[i] == 'L') x--;
    if (s[i] == 'U') y++;
    if (s[i] == 'D') y--;
    if (fabs(x - curx) + fabs(y - cury) < i + 1 - curi) {
      ans++;
      curx = prevx;
      cury = prevy;
      curi = i;
    }
  }
  cout << ans + 1;
  return 0;
}
