#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int x = 0, y = 0, countx = 0, county = 0, cMoves = 0;
  for (auto it = s.begin(); it != s.end(); it++) {
    if (*it == 'L') {
      x--;
      countx++;
    } else if (*it == 'R') {
      x++;
      countx++;
    } else if (*it == 'U') {
      y++;
      county++;
    } else {
      y--;
      county++;
    }
    if (x == 0) {
      cMoves += countx;
      countx = 0;
    }
    if (y == 0) {
      cMoves += county;
      county = 0;
    }
  }
  cout << n - abs(x) - abs(y);
  return 0;
}
