#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65000000")
#pragma warning(disable : 4996)
using namespace std;
map<char, int> mp;
const int n_max = 200013;
int n, ans;
char a[n_max];
bool fl[6];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  mp['U'] = 0;
  mp['D'] = 3;
  mp['L'] = 1;
  mp['R'] = 2;
  for (int i = 1; i <= n; i++) {
    if (fl[3 - mp[a[i]]]) {
      for (int j = 0; j <= 3; j++) {
        fl[j] = false;
      }
      ans++;
    }
    fl[mp[a[i]]] = true;
  }
  cout << ans + 1;
  return 0;
}
