#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  string s;
  cin >> n >> s;
  pair<int, int> base = {0, 0};
  pair<int, int> curr = {0, 0};
  pair<int, int> bef = {-1, -1};
  int tilNow = 0, ans = 1;
  for (int i = 0; i < n; i++) {
    bef = curr;
    tilNow++;
    if (s[i] == 'U') {
      curr.second++;
    } else if (s[i] == 'D') {
      curr.second--;
    } else if (s[i] == 'R') {
      curr.first++;
    } else if (s[i] == 'L') {
      curr.first--;
    }
    if (abs(base.first - curr.first) + abs(curr.second - base.second) <
        tilNow) {
      ans++;
      base = bef;
      tilNow = 1;
    }
  }
  cout << ans;
  return 0;
}
