#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;
const long long inf = 1e18 + 1;
const long double eps = pow(2, -52);
string s;
set<char> st;
int n, flag, dir, ans, a[5];
int main() {
  cin >> n >> s;
  string test = "";
  for (int i = 0; i < n; i++) {
    if (test.length() == 0) {
      test += s[i];
    } else if (test.length() == 1) {
      if (test[0] != s[i]) {
        if ((s[i] == 'L' && test[0] == 'R') ||
            (s[i] == 'U' && test[0] == 'D') ||
            (s[i] == 'R' && test[0] == 'L') ||
            (s[i] == 'D' && test[0] == 'U')) {
          ans++;
          test = s[i];
        } else {
          if (s[i] != test[0]) test += s[i];
        }
      }
    } else {
      if (s[i] != test[0] && s[i] != test[1]) {
        ans++;
        test = "";
        test += s[i];
      }
    }
  }
  cout << ans + 1;
}
