#include <bits/stdc++.h>
using namespace std;
int n, ans, dis;
int lx, ly, x, y;
vector<pair<int, int> > vis;
int man(int x1, int y1, int x2, int y2) { return abs(x1 - x2) + abs(y1 - y2); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    int x1 = x, y1 = y;
    if (s[i] == 'U') {
      ++y1;
    }
    if (s[i] == 'D') {
      --y1;
    }
    if (s[i] == 'R') {
      ++x1;
    }
    if (s[i] == 'L') {
      --x1;
    }
    if (man(lx, ly, x1, y1) < dis) {
      vis.push_back({x, y});
      lx = x;
      ly = y;
      dis = 0;
    }
    x = x1;
    y = y1;
    ++dis;
  }
  vis.push_back({x, y});
  ans = vis.size();
  cout << ans;
}
