#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const long long N = 1e5 + 5, M = 1e9 + 7;
char ulta[500];
set<char> ache;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ulta['U'] = 'D';
  ulta['D'] = 'U';
  ulta['R'] = 'L';
  ulta['L'] = 'R';
  string s;
  long long n, i, j, k, ans = 2;
  cin >> n >> s;
  for (auto ch : s) {
    auto x = ache.find(ulta[ch]);
    if (x != ache.end()) {
      ans++;
      ache.clear();
    }
    ache.insert(ch);
  }
  cout << ans - 1 << endl;
}
