#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
using matrix = vector<vector<long long>>;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, ans = 1;
  string s;
  cin >> n >> s;
  pair<long long, long long> last = {0, 0}, cur = {0, 0};
  long long cnt = 0;
  for (long long i = 0; i < n; ++i) {
    if (s[i] == 'U') {
      cur.first++;
    } else if (s[i] == 'D') {
      cur.first--;
    } else if (s[i] == 'R') {
      cur.second++;
    } else if (s[i] == 'L') {
      cur.second--;
    }
    cnt++;
    long long res = abs(cur.first - last.first) + abs(cur.second - last.second);
    if (cnt > res) {
      pair<long long, long long> tmp = cur;
      ans++;
      if (s[i] == 'U') {
        cur.first--;
      } else if (s[i] == 'D') {
        cur.first++;
      } else if (s[i] == 'R') {
        cur.second--;
      } else if (s[i] == 'L') {
        cur.second++;
      }
      last = cur;
      cur = tmp;
      cnt = 1;
    }
  }
  cout << ans;
}
