#include <bits/stdc++.h>
using namespace std;
struct ppp {
  void init() {
    x = 0;
    y = 0;
  }
  int x;
  int y;
};
int dist(ppp a, ppp b) { return (abs(a.x - b.x) + abs(a.y - b.y)); }
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  ppp q;
  q.init();
  ppp last;
  last.init();
  int d = 0;
  int w = 0;
  for (int i = 0; i < s.length(); i++) {
    ppp r = q;
    if (s[i] == 'U') q.y++;
    if (s[i] == 'D') q.y--;
    if (s[i] == 'R') q.x++;
    if (s[i] == 'L') q.x--;
    if (d < dist(last, q)) {
      d = dist(last, q);
    } else {
      w++;
      d = 0;
      last = r;
    }
  }
  cout << w + 1;
  return 0;
}
