#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int d4x[4] = {1, 0, -1, 0};
int d4y[4] = {0, 1, 0, -1};
int d8x[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int d8y[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long oo = 1e18;
const long long maxN = 1e6;
void maximize(int &a, int b) { a = max(a, b); }
void minimize(int &a, int b) { a = min(a, b); }
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 1;
  bool L, R, U, D;
  L = R = U = D = false;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'L') {
      L = true;
      if (R) {
        ans++;
        R = U = D = false;
      }
    }
    if (s[i] == 'R') {
      R = true;
      if (L) {
        ans++;
        L = U = D = false;
      }
    }
    if (s[i] == 'U') {
      U = true;
      if (D) {
        ans++;
        D = L = R = false;
      }
    }
    if (s[i] == 'D') {
      D = true;
      if (U) {
        ans++;
        U = L = R = false;
      }
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc = 1, ddd = 0;
  while (tc--) {
    solve();
  }
}
