#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  string s;
  cin >> n;
  cin >> s;
  set<char> seen;
  map<char, int> mapper = {{'L', -1}, {'R', 1}, {'U', 2}, {'D', -2}};
  int ans = 1;
  for (auto c : s) {
    if (mapper[c] + mapper[*seen.begin()] == 0) {
      ans++;
      seen.clear();
    }
    seen.insert(c);
    if (int(seen.size()) > 2) {
      ans++;
      seen.clear();
      seen.insert(c);
    }
  }
  cout << ans;
  return 0;
}
