#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n;
  cin >> n >> s;
  int x, y, cnt, ans, lx, ly, bx, by;
  x = y = ans = bx = by = lx = ly = 0;
  cnt = 1;
  for (int i = 0; i < (int)s.size(); ++i) {
    x = lx;
    y = ly;
    if (s[i] == 'L') x--;
    if (s[i] == 'R') x++;
    if (s[i] == 'U') y++;
    if (s[i] == 'D') y--;
    if (abs(bx - x) + abs(by - y) < cnt) {
      bx = lx;
      by = ly;
      ans++;
      cnt = 1;
    }
    cnt++;
    lx = x;
    ly = y;
  }
  cout << ans + 1 << endl;
  return 0;
}
