#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int initx = 0, inity = 0;
  int shortest = 0;
  int ans = 1;
  int posx = 0, posy = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'U')
      posy++;
    else if (s[i] == 'D')
      posy--;
    else if (s[i] == 'R')
      posx++;
    else
      posx--;
  }
  initx = posx;
  inity = posy;
  for (int i = s.length() - 1; i >= 0; i--) {
    int prevx = posx;
    int prevy = posy;
    if (s[i] == 'D')
      posy++;
    else if (s[i] == 'U')
      posy--;
    else if (s[i] == 'L')
      posx++;
    else
      posx--;
    if (abs(posx - initx) + abs(posy - inity) < shortest) {
      ans++;
      initx = prevx;
      inity = prevy;
      shortest = 1;
    } else {
      shortest = abs(posx - initx) + abs(posy - inity);
    }
  }
  cout << ans;
  return 0;
}
