#include <bits/stdc++.h>
using namespace std;
char arr[201];
int n;
int h, v;
void see(char ch) {
  if (ch == 'U')
    v++;
  else if (ch == 'D')
    v--;
  else if (ch == 'R')
    h++;
  else
    h--;
}
int main() {
  scanf("%d", &n);
  scanf("%s", arr);
  int ans = 0;
  for (int c = 0; c < n; c++) {
    h = 0;
    v = 0;
    see(arr[c]);
    for (int d = c + 1; d < n; d++) {
      see(arr[d]);
      if (h == 0 and v == 0) ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
