#include <bits/stdc++.h>
using namespace std;
int dist(pair<int, int> a, pair<int, int> b) {
  return abs(a.first - b.first) + abs(a.second - b.second);
}
pair<int, int> go(pair<int, int> a, char ch) {
  if (ch == 'L') {
    return {a.first - 1, a.second};
  }
  if (ch == 'R') {
    return {a.first + 1, a.second};
  }
  if (ch == 'U') {
    return {a.first, a.second + 1};
  }
  if (ch == 'D') {
    return {a.first, a.second - 1};
  }
}
int main() {
  int n;
  cin >> n;
  int second = 1;
  pair<int, int> previous_point = {0, 0}, cur_pos = {0, 0};
  for (int i = 0; i < n; ++i) {
    int dist1;
    pair<int, int> pred = cur_pos;
    char ch;
    cin >> ch;
    dist1 = dist(previous_point, cur_pos);
    cur_pos = go(cur_pos, ch);
    if (dist(previous_point, cur_pos) > dist1) {
      continue;
    } else {
      ++second;
      previous_point = pred;
    }
  }
  cout << second;
  return 0;
}
