#include <bits/stdc++.h>
using namespace std;
int toInt(string s) {
  stringstream as;
  as << s;
  int a;
  as >> a;
  return a;
}
struct point {
  int x, y;
  point(int xx, int yy) { x = xx, y = yy; }
};
void get_change(point &a, char c) {
  if (c == 'U') a.y++;
  if (c == 'D') a.y--;
  if (c == 'R') a.x++;
  if (c == 'L') a.x--;
}
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<point> pnt;
  pnt.push_back(point(0, 0));
  point now = pnt[0], prev = pnt[0];
  int rast = 0, mhrast = 0;
  for (int i = s.size() - 1; i >= 0; i--) {
    get_change(now, s[i]);
    rast++;
    mhrast = abs(pnt.back().x - now.x) + abs(pnt.back().y - now.y);
    if (rast > mhrast) {
      pnt.push_back(prev);
      rast = 1;
    }
    prev = now;
  }
  cout << pnt.size();
  return 0;
}
