#include <bits/stdc++.h>
using namespace std;
bool f1(char a, char b) {
  if ((a == 'U' && b == 'D') || (a == 'D' && b == 'U') ||
      (a == 'L' && b == 'R') || (a == 'R' && b == 'L'))
    return false;
  return true;
}
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long ans = 1;
  char p1 = 'a', p2 = 'a';
  for (int i = 0; i < s.size(); ++i) {
    if (p1 == 'a') {
      p1 = s[i];
      continue;
    }
    if (p2 == 'a' && s[i] != p1 && f1(s[i], p1)) {
      p2 = s[i];
      continue;
    }
    if (s[i] == p1 || s[i] == p2) {
      continue;
    } else {
      ++ans;
      p1 = s[i];
      p2 = 'a';
    }
  }
  cout << ans << endl;
  return 0;
}
