#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
void solve() {
  long long n;
  cin >> n;
  ;
  string s;
  cin >> s;
  ;
  vector<char> op(256);
  op['D'] = 'U';
  op['U'] = 'D';
  op['L'] = 'R';
  op['R'] = 'L';
  long long ans = 0;
  vector<bool> used(256);
  for (long long i = 0; i < n; i++) {
    if (used[op[s[i]]]) {
      ans++;
      used.assign(256, false);
      used[s[i]] = true;
    } else {
      used[s[i]] = true;
    }
  }
  cout << ans + 1 << endl;
}
signed main() {
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  solve();
}
