#include <bits/stdc++.h>
using namespace std;
const int INF = 1e7;
const int maxn = 200000 + 10;
const double EPS = 1e-5;
const int mod = 1e8 + 7;
const double g = 9.81;
int a[4];
int n;
char s[maxn];
int main() {
  while (~scanf("%d%s", &n, s)) {
    int ans = 0;
    memset(a, 0, sizeof a);
    int len = strlen(s);
    for (int i = 0; i < len; ++i) {
      if (s[i] == 'U') {
        if (a[1]) {
          ans++;
          a[1] = a[2] = a[3] = 0;
        }
        a[0]++;
      } else if (s[i] == 'D') {
        if (a[0]) {
          ans++;
          a[0] = a[2] = a[3] = 0;
        }
        a[1]++;
      } else if (s[i] == 'L') {
        if (a[3]) {
          ans++;
          a[1] = a[3] = a[0] = 0;
        }
        a[2]++;
      } else {
        if (a[2]) {
          ans++;
          a[1] = a[0] = a[2] = 0;
        }
        a[3]++;
      }
    }
    printf("%d\n", ans + 1);
  }
  return 0;
}
