#include <bits/stdc++.h>
using namespace std;
int main() {
  const int siz = 201;
  short U[siz]{}, D[siz]{}, R[siz]{}, L[siz]{};
  string s;
  int n;
  cin >> n >> s;
  for (int i = 1; i <= n; ++i) {
    U[i] = U[i - 1];
    D[i] = D[i - 1];
    R[i] = R[i - 1];
    L[i] = L[i - 1];
    switch (s[i - 1]) {
      case 'U':
        ++U[i];
        break;
      case 'D':
        ++D[i];
        break;
      case 'R':
        ++R[i];
        break;
      case 'L':
        ++L[i];
        break;
    }
  }
  short ans = 0;
  for (int w = 2; w <= n; ++w)
    for (int l = 0, r = l + w; r <= n; ++r, ++l)
      if (U[r] - U[l] == D[r] - D[l] && R[r] - R[l] == L[r] - L[l]) ++ans;
  cout << ans << endl;
  return 0;
}
