#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  gcd(b, a % b);
}
void sieve() {
  long long int i, j;
  long long int b[1000009];
  for (i = 2; i < 1000009; i++) {
    if (b[i] == 0) {
      for (j = 2 * i; j < 1000009; j = j + i) b[j] = 1;
    }
  }
}
long long int bs(pair<long long int, long long int> p[], long long int n,
                 long long int key, long long int i) {
  long long int low = i, high = n - 1;
  long long int ans = -1;
  while (low <= high) {
    long long int mid = low + high;
    mid = mid / 2;
    if (p[mid].first > key)
      high = mid - 1;
    else {
      low = mid + 1;
      ans = mid;
    }
  }
  return ans;
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2, p);
}
long long int nCrModPFermat(long long int n, long long int r, long long int p) {
  if (n < r) return 0;
  if (r == 0) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
struct piyush {
  long long int data;
  long long int in;
};
bool cmp(piyush a, piyush b) { return a.data < b.data; }
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, i, j, k, t;
  cin >> n;
  string s;
  cin >> s;
  long long int z = -1;
  unordered_map<char, long long int> mp;
  mp['R'] = 1;
  mp['L'] = 2;
  mp['U'] = 3;
  mp['D'] = 4;
  long long int ans = 0, cnt = 0;
  vector<long long int> v;
  k = mp[s[0]];
  v.push_back(k);
  for (i = 1; i < n; i++) {
    if (s[i] == s[i - 1]) continue;
    if (v.size() == 1) {
      long long int d = mp[s[i]];
      if (v[0] == 1 && d == 2) {
        ans++;
        v.pop_back();
        v.push_back(d);
      } else if (v[0] == 2 && d == 1) {
        ans++;
        v.pop_back();
        v.push_back(d);
      } else if (v[0] == 3 && d == 4) {
        ans++;
        v.pop_back();
        v.push_back(d);
      } else if (v[0] == 4 && d == 3) {
        ans++;
        v.pop_back();
        v.push_back(d);
      } else {
        v.push_back(d);
      }
    } else {
      long long int d = mp[s[i]];
      if (v[0] != d) {
        v.pop_back();
        v.pop_back();
        ans++;
        v.push_back(d);
      } else {
        v[0] = v[1];
        v[1] = d;
      }
    }
  }
  ans++;
  cout << ans + cnt << endl;
}
