Calvin the robot lies in an infinite rectangular grid. Calvin's source code contains a list of n commands, each either 'U', 'R', 'D', or 'L' — instructions to move a single square up, right, down, or left, respectively. How many ways can Calvin execute a non-empty contiguous substrings of commands and return to the same square he starts in? Two substrings are considered different if they have different starting or ending indices.

Input

The first line of the input contains a single positive integer, n (1 ≤ n ≤ 200) — the number of commands.

The next line contains n characters, each either 'U', 'R', 'D', or 'L' — Calvin's source code.

Output

Print a single integer — the number of contiguous substrings that Calvin can execute and return to his starting square.

Examples

Input

6
URLLDR


Output

2


Input

4
DLUU


Output

0


Input

7
RLRLRLR


Output

12

Note

In the first case, the entire source code works, as well as the "RL" substring in the second and third characters.

Note that, in the third case, the substring "LR" appears three times, and is therefore counted three times to the total result.
import java.util.*;
import java.io.*;
import java.math.*;
import java.util.regex.Matcher;
//linkedhashmap contains the entry in the same order which we are giving and not in sorted way like in hashmaps
public class CF {
    FastScanner in;
    PrintWriter out;
    final static int M=1000001;
    public ArrayList<Integer> input(int m){
        ArrayList<Integer> li= new ArrayList<>();
        for(int i=0;i<m;i++)
            li.add(in.nextInt());
        return li;
    }
    class Pair{
        int x;
        int y;
    }
    public class pair<T,V> {
        private T x;
        private V y;

        public void setY(V y) {
            this.y = y;
        }

        public V getY() {
            return y;
        }

        public void setX(T x) {
            this.x = x;
        }

        public T getX() {
            return x;
        }
    }
    Set<Long> primeFactors(long n)
    {
        // Print the number of 2s that divide n
        Set<Long> li=new HashSet<>();

        while (n%2 == 0)
        {
            li.add(2L);
            n = n/2;
        }

        // n must be odd at this point.  So we can skip one element (Note i = i +2)
        for (long i = 3; i <= Math.sqrt(n); i = i+2)
        {
            // While i divides n, print i and divide n
            while (n%i == 0)
            {
                li.add(i);
                n = n/i;
            }
        }

        // This condition is to handle the case whien n is a prime number
        // greater than 2
        if (n > 2)
            li.add(n);
        return li;
    }
    int res[];
    void sieve(){
        res=new int[10000009];

        int p[]=new int[10000009];
        for(int i=2;i<=10000000;i++){
            if(p[i]==0){
                for(int j=i+i;j<=10000000;j+=i){
                    if(p[i]==0){
                        p[j]=i;
                    }
                    res[i]=res[i-1]+i;
                }
            }
            else{
                res[i]=res[i-1]+p[i];
            }
        }
    }
    public static HashSet<String> getAllPermutations(String str) {

        HashSet<String> permutations = new HashSet<String>();

        if(str == null || str.length() == 0) {
            permutations.add("" );
            return permutations;
        }

        char first = str.charAt(0);
        String remainingString = str.substring(1);
        HashSet<String> words = getAllPermutations(remainingString);
        for(String word: words) {
            for(int i = 0; i <= word.length(); i++) {
                String prefix = word.substring(0, i);
                String suffix = word.substring(i);
                permutations.add(prefix + first + suffix);
            }
        }
        return permutations;
    }

    //    static class Pair<T> {
//        T a;
//        T b;
//
//        public Pair(T a, T b) {
//            this.a = a;
//            this.b = b;
//        }
//    }
    private ArrayList<Integer> adj[];
    private boolean visited[];
    // private boolean visited1[];
    private LinkedList<Integer> q;
    private int level[];
    private int f=0;
    void initialize(){
        visited=new boolean[20001];
        //visited1=new boolean[10001];
        level =new int[20001];
        Arrays.fill(visited,false);
    }
    void solve() {
        int n=in.nextInt();
        String s=in.next();int ans=0;
        char c[]=s.toCharArray();
        for(int i=0;i<n;i++){
            int x=0,y=0;
            for(int j=i;j<n;j++){
                if(c[j]=='U')
                    y++;
                if(c[j]=='D')
                    y--;
                if(c[j]=='R')
                    x++;
                if(c[j]=='L')
                    x--;
                if(x==0 && y==0)
                    ans++;
            }
        }
        System.out.println(ans);

    }
    private int[] calculateZ(char input[]) {
        int Z[] = new int[input.length];
        int left = 0;
        int right = 0;
        for(int k = 1; k < input.length; k++) {
            if(k > right) {
                left = right = k;
                while(right < input.length && input[right] == input[right - left]) {
                    right++;
                }
                Z[k] = right - left;
                right--;
            } else {
//we are operating inside box
                int k1 = k - left;
//if value does not stretches till right bound then just copy it.
                if(Z[k1] <= right - k + 1) {
                    Z[k] = Z[k1];
                } else { //otherwise try to see if there are more matches.
                    left = k;
                    while(right < input.length && input[right] == input[right - left]) {
                        right++;
                    }
                    Z[k] = right - left;
                    right--;
                }
            }
        }
        return Z;
    }

    void bfs1(int i){
        q=new LinkedList<>();
        q.add(i);
        visited[i]=true;
        while(!q.isEmpty()){
            int s=q.peekFirst();
            q.removeFirst();
            for(int j=0;j<adj[s].size();j++){
                if(!visited[adj[s].get(j)]){
                    level[adj[s].get(j)]=(level[s]+1);
                    q.add(adj[s].get(j));
                    visited[adj[s].get(j)]=true;
                }

            }
        }
    }
    int bfs(int i){
        q=new LinkedList<>();
        q.add(i);
        visited[i]=true;int g=0;
        while(!q.isEmpty()){
            int s=q.peekFirst();
            if(q.size()==1 && adj[s].size()==1)
            {
                g=s;
            }
            q.removeFirst();
            for(int j=0;j<adj[s].size();j++){
                if(!visited[adj[s].get(j)]){
                    //level[adj[s].get(j)]=level[s]+1;
                    q.add(adj[s].get(j));
                    visited[adj[s].get(j)]=true;
                }
            }
        }
        return g;
    }
    boolean dfs(int i,int parent){
        visited[i]=true;
        for(int j=0;j<adj[i].size();j++){
            if(adj[i].get(j)==parent && visited[i])
                continue;
            if(!visited[adj[i].get(j)]) {
                f++;
            }
            if(dfs(adj[i].get(j),i)){
                return true;
            }
        }
        return false;
    }
    static boolean isPali(StringBuilder s){
        for(int i = 0; i < (s.length() >> 1); i++)
            if(s.charAt(i) != s.charAt(s.length() - 1 - i))
                return false;
        return true;
    }
    void run(){
        try {
            in = new FastScanner(new File("B.in"));
            out = new PrintWriter(new File("B.out"));
            solve();
            out.close();
        }
        catch(FileNotFoundException e){
            e.printStackTrace();
        }
    }

    void runIO(){
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();
        out.close();
    }
    class FastScanner{
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(File f){
            try{
                br = new BufferedReader(new FileReader(f));
            }
            catch(FileNotFoundException e){
                e.printStackTrace();
            }
        }
        public FastScanner(InputStream f){
            br = new BufferedReader(new InputStreamReader(f));
        }
        String next(){
            while(st==null || !st.hasMoreTokens()){
                String s = null;
                try{
                    s= br.readLine();
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(s==null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens(){
            while(st==null || !st.hasMoreTokens()){
                String s = null;
                try{
                    s= br.readLine();
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(s==null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        new CF().runIO();
    }
}