#include <bits/stdc++.h>
using namespace std;
int n, ans;
string s;
bool arr[5];
int main() {
  memset(arr, 0, sizeof(arr));
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R' && arr[2])
      ans++, arr[1] = 1, arr[2] = 0, arr[3] = 0, arr[4] = 0;
    else if (s[i] == 'R' && !arr[2])
      arr[1] = 1;
    else if (s[i] == 'L' && arr[1])
      ans++, arr[1] = 0, arr[2] = 1, arr[3] = 0, arr[4] = 0;
    else if (s[i] == 'L' && !arr[1])
      arr[2] = 1;
    if (s[i] == 'U' && arr[4])
      ans++, arr[3] = 1, arr[4] = 0, arr[1] = 0, arr[2] = 0;
    else if (s[i] == 'U' && !arr[4])
      arr[3] = 1;
    else if (s[i] == 'D' && arr[3])
      ans++, arr[3] = 0, arr[4] = 1, arr[1] = 0, arr[2] = 0;
    else if (s[i] == 'D' && !arr[3])
      arr[4] = 1;
  }
  if (arr[1] || arr[2] || arr[3] || arr[4])
    cout << ans + 1;
  else
    cout << ans;
  return 0;
}
