#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
using namespace std;
const int INF = 1000000000;
const int MAX = 2007;
const int ADD = 500107;
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int x0 = 0;
  int y0 = 0;
  int count = 1;
  int x = 0;
  int y = 0;
  bool left_right = 0, up_down = 0;
  bool lefts = 0, rights = 0, ups = 0, downs = 0;
  for (int i = (0); i < (n); ++i) {
    char k;
    cin >> k;
    if (k == 'L') {
      if (left_right) {
        if (lefts)
          continue;
        else {
          lefts = 1;
          rights = 0;
          left_right = 1;
          up_down = 0;
          ups = 0;
          downs = 0;
          count++;
        }
      } else {
        left_right = 1;
        lefts = 1;
      }
    }
    if (k == 'R') {
      if (left_right) {
        if (rights)
          continue;
        else {
          lefts = 0;
          rights = 1;
          left_right = 1;
          up_down = 0;
          ups = 0;
          downs = 0;
          count++;
        }
      } else {
        left_right = 1;
        rights = 1;
      }
    }
    if (k == 'U') {
      if (up_down) {
        if (ups)
          continue;
        else {
          lefts = 0;
          rights = 0;
          left_right = 0;
          up_down = 1;
          ups = 1;
          downs = 0;
          count++;
        }
      } else {
        up_down = 1;
        ups = 1;
      }
    }
    if (k == 'D') {
      if (up_down) {
        if (downs)
          continue;
        else {
          lefts = 0;
          rights = 0;
          left_right = 0;
          up_down = 1;
          ups = 0;
          downs = 1;
          count++;
        }
      } else {
        up_down = 1;
        downs = 1;
      }
    }
  }
  cout << count;
}
