#include <bits/stdc++.h>
using namespace std;
long long n;
string s;
bitset<1000007> yet;
long long ind(char x) {
  if (x == 'L') return 3;
  if (x == 'R') return 2;
  if (x == 'U') return 1;
  if (x == 'D') return 4;
}
void solve() {
  cin >> n >> s;
  long long rst = 1;
  for (long long i = 0; i < (n); ++i) {
    if (yet[5 - ind(s[i])]) {
      ++rst;
      yet = 0;
    }
    yet[ind(s[i])] = 1;
  }
  cout << rst;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  solve();
  return 0;
}
