#include <bits/stdc++.h>
using namespace std;
const int N = 300500;
char a[N];
int go(int x, int y, int x1, int y4) { return abs(x - x1) + abs(y4 - y); }
int main() {
  srand(time(NULL));
  int n;
  cin >> n;
  int x = 0, y = 0;
  int x1 = 0, y4 = 0;
  int ans = 0;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    int nwx = x1, nwy = y4;
    cnt++;
    if (a[i] == 'R') nwx++;
    if (a[i] == 'L') nwx--;
    if (a[i] == 'U') nwy++;
    if (a[i] == 'D') nwy--;
    if (cnt == go(x, y, nwx, nwy)) {
      x1 = nwx;
      y4 = nwy;
    } else {
      x = x1;
      y = y4;
      x1 = nwx;
      y4 = nwy;
      cnt = 1;
      ans++;
    }
  }
  cout << ans + 1;
  return 0;
}
