#include <bits/stdc++.h>
constexpr bool test_cases = false;
void solve() {
  int n;
  std::string s;
  std::cin >> n >> s;
  int x = 0, y = 0;
  int a = 0, b = 0;
  int cnt = 1, last = -1;
  for (int i = 0; i < n; ++i) {
    int oldx = x;
    int oldy = y;
    if (s[i] == 'L') --x;
    if (s[i] == 'R') ++x;
    if (s[i] == 'D') --y;
    if (s[i] == 'U') ++y;
    if (std::abs(a - x) + std::abs(b - y) == i - last) continue;
    ++cnt;
    a = oldx;
    b = oldy;
    last = i - 1;
  }
  std::cout << cnt << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.precision(10);
  std::cerr.precision(10);
  std::cout << std::fixed << std::boolalpha;
  std::cerr << std::fixed << std::boolalpha;
  int32_t cases = 1;
  if (test_cases) std::cin >> cases;
  while (cases--) solve();
  return 0;
}
