#include <bits/stdc++.h>
using namespace std;
int ans;
set<char> cur;
int main() {
  int n;
  cin >> n;
  char c, p = 'Q';
  int x = 0, y = 0;
  scanf("%c", &c);
  for (int i = 0; i < n; ++i) {
    scanf("%c", &c);
    cur.insert(c);
    if (c == 'L')
      y--;
    else if (c == 'R')
      y++;
    else if (c == 'U')
      x++;
    else if (c == 'D')
      x--;
    if (cur.size() > 2 || (c == 'D' && p == 'U') || (c == 'U' && p == 'D') ||
        (c == 'R' && p == 'L') || (c == 'L' && p == 'R')) {
      ans++;
      cur.clear();
      cur.insert(c);
    }
    p = c;
  }
  ans++;
  cout << ans;
  return 0;
}
