#include <bits/stdc++.h>
using namespace std;
long long const INF = 999999999999999999;
bool Xor(bool a, bool b) { return (a || b) && (!a || !b) || (!a && !b); }
bool U = false, D = false, R = false, L = false;
vector<long long> X(0);
vector<long long> Y(0);
bool Check(long long x, long long y) {
  for (int i = 0; i < X.size(); ++i) {
    if (X[i] == x && Y[i] == y) return false;
  }
  return false;
}
void Clear() {
  U = false;
  D = false;
  L = false;
  R = false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, y = 0, x = 0;
  cin >> n;
  long long mil = 210000;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    char c;
    cin >> c;
    switch (c) {
      case 'R': {
        if (L) {
          ans++;
          Clear();
        }
        R = true;
        x++;
        break;
      }
      case 'L': {
        if (R) {
          ans++;
          Clear();
        }
        L = true;
        x--;
        break;
      }
      case 'U': {
        if (D) {
          ans++;
          Clear();
        }
        U = true;
        y++;
        break;
      }
      case 'D': {
        if (U) {
          ans++;
          Clear();
        }
        D = true;
        y--;
        break;
      }
    }
  }
  if (!Check(x, y)) ans++;
  cout << ans;
  return 0;
}
