#include <bits/stdc++.h>
using namespace std;
int n, x, y, ans = 1, aux;
string pal;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> pal;
  for (int i = 0; i < n; i++) {
    if (pal[i] == 'R') {
      x++;
    } else if (pal[i] == 'L') {
      x--;
    } else if (pal[i] == 'U') {
      y++;
    } else
      y--;
    aux++;
    if (abs(x) + abs(y) != aux) {
      ans++;
      aux = 1;
      x = y = 0;
      if (pal[i] == 'R') {
        x++;
      } else if (pal[i] == 'L') {
        x--;
      } else if (pal[i] == 'U') {
        y++;
      } else
        y--;
    }
  }
  cout << ans;
}
