#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int p1 = 0, q1 = 0, r1 = 0, s1 = 0;
  int ans = 1;
  int a = 0, b = 0, c = 0, d = 0;
  vector<int> v;
  int sum = 0;
  for (int j = 0; j < s.length(); j++) {
    if (s[j] == 'R') {
      if ((q1 > 0 && r1 > 0) || (q1 > 0 && s1 > 0) || (s1 > 0 && r1 > 0) ||
          (q1 > 0)) {
        ans++;
        v.push_back(j);
        q1 = 0;
        r1 = 0;
        s1 = 0;
      }
      p1++;
    }
    if (s[j] == 'L') {
      if ((p1 > 0 && r1 > 0) || (p1 > 0 && s1 > 0) || (s1 > 0 && r1 > 0) ||
          (p1 > 0)) {
        ans++;
        v.push_back(j);
        p1 = 0;
        r1 = 0;
        s1 = 0;
      }
      q1++;
    }
    if (s[j] == 'U') {
      if ((q1 > 0 && p1 > 0) || (q1 > 0 && s1 > 0) || (s1 > 0 && p1 > 0) ||
          (s1 > 0)) {
        ans++;
        v.push_back(j);
        q1 = 0;
        p1 = 0;
        s1 = 0;
      }
      r1++;
    }
    if (s[j] == 'D') {
      if ((q1 > 0 && r1 > 0) || (q1 > 0 && p1 > 0) || (r1 > 0 && p1 > 0) ||
          (r1 > 0)) {
        ans++;
        v.push_back(j);
        q1 = 0;
        r1 = 0;
        p1 = 0;
      }
      s1++;
    }
  }
  cout << ans;
}
