#include <bits/stdc++.h>
using namespace std;
const int maxn = 200001, INF = 10000000;
int n, k;
char rp1, rp2, r;
int main() {
  cin >> n;
  cin >> rp1;
  rp2 = '#';
  for (int i = 0; i < n - 1; i++) {
    cin >> r;
    if (rp1 == '#') {
      rp1 = r;
    } else if (rp2 == '#') {
      if (rp1 == 'U' && r == 'D') {
        k++;
        rp1 = 'D';
      } else if (rp1 == 'D' && r == 'U') {
        k++;
        rp1 = 'U';
      } else if (rp1 == 'R' && r == 'L') {
        k++;
        rp1 = 'L';
      } else if (rp1 == 'L' && r == 'R') {
        k++;
        rp1 = 'R';
      } else {
        if (rp1 != r) rp2 = r;
      }
    } else if (r != rp1 && r != rp2) {
      rp1 = r;
      k++;
      rp2 = '#';
    }
  }
  cout << k + 1;
}
