#include <bits/stdc++.h>
using namespace std;
string s, t;
bool used[500][500], mark[500];
vector<pair<int, int> > ans;
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  int cnt = 0;
  cin >> s;
  int dx = 0, dy = 0;
  for (int i = 0; i < n; i++) {
    if (dx == 0 && dy == 0) {
      if (s[i] == 'R') dx = 1;
      if (s[i] == 'L') dx = -1;
      if (s[i] == 'U') dy = 1;
      if (s[i] == 'D') dy = -1;
      cnt++;
      continue;
    }
    if (s[i] == 'R' && dx != 1) {
      if (dx == -1) {
        cnt++;
        dy = 0;
      }
      dx = 1;
      continue;
    }
    if (s[i] == 'L' && dx != -1) {
      if (dx == 1) {
        cnt++;
        dy = 0;
      }
      dx = -1;
      continue;
    }
    if (s[i] == 'U' && dy != 1) {
      if (dy == -1) {
        cnt++;
        dx = 0;
      }
      dy = 1;
      continue;
    }
    if (s[i] == 'D' && dy != -1) {
      if (dy == 1) {
        cnt++;
        dx = 0;
      }
      dy = -1;
      continue;
    }
  }
  cout << cnt;
  return 0;
}
