#include <bits/stdc++.h>
using namespace std;
int dist(pair<int, int> &a, pair<int, int> &b) {
  int x = abs(a.first - b.first);
  int y = abs(a.second - b.second);
  return x + y;
}
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  string a;
  cin >> a;
  pair<int, int> point, last, atual;
  point.first = point.second = 0;
  last.first = last.second = 0;
  atual = last;
  int qtd = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    qtd++;
    if (a[i] == 'R') point.second++;
    if (a[i] == 'L') point.second--;
    if (a[i] == 'U') point.first++;
    if (a[i] == 'D') point.first--;
    if (dist(point, last) < qtd) {
      qtd = 0;
      last = atual;
      ans++;
    }
    atual = point;
  }
  printf("%d\n", ans + 1);
  return 0;
}
