#include <bits/stdc++.h>
using namespace std;
bool f(string s) {
  string vec[8] = {"URD", "RDL", "DLU", "LUR", "DRU", "LDR", "ULD", "RUL"};
  for (int i = 0; i < 8; i++) {
    if (s == vec[i]) return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  string v;
  v += s[0];
  for (int i = 1; i < n; i++)
    if (s[i] != s[i - 1]) v += s[i];
  n = v.size();
  int ans = 1;
  for (int i = 1; i < n; i++) {
    if (v[i] == 'L' && v[i - 1] == 'R')
      ans++;
    else if (v[i] == 'R' && v[i - 1] == 'L')
      ans++;
  }
  for (int i = 1; i < n; i++) {
    if (v[i] == 'D' && v[i - 1] == 'U')
      ans++;
    else if (v[i] == 'U' && v[i - 1] == 'D')
      ans++;
  }
  for (int i = 2; i < n; i++) {
    string t;
    t = v[i - 2];
    t += v[i - 1];
    t += v[i];
    if (f(t)) {
      ans++;
      i++;
    }
  }
  cout << ans;
  return 0;
}
