#include <bits/stdc++.h>
char A[300000] = {0};
using namespace std;
int main() {
  long long n, s = 1, a1 = 0, b1 = 0, a2 = 0, b2 = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> A[i];
  for (int i = 1; i <= n; i++) {
    if (A[i] == 'R') a1 = 1;
    if (A[i] == 'L') a1 = -1;
    if (A[i] == 'U') b1 = 1;
    if (A[i] == 'D') b1 = -1;
    if (a1 + a2 == 0 && a1 != 0 || b1 + b2 == 0 && b1 != 0) {
      s++;
      a1 = 0;
      b1 = 0;
      if (A[i] == 'R') a1 = 1;
      if (A[i] == 'L') a1 = -1;
      if (A[i] == 'U') b1 = 1;
      if (A[i] == 'D') b1 = -1;
    }
    a2 = a1;
    b2 = b1;
  }
  cout << s;
}
