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.io.*;
import java.util.StringTokenizer;

/**
 * @author ayratgdl
 * @date 13.02.16
 */
public class A {
    private static IO.In in = IO.in;
    private static IO.Out out = IO.out;

    public static void main(String[] args) {
        int size = in.int1();
        char[] commands = in.word().toCharArray();
        int count = 0;
        for (int i = 0; i < commands.length-1; i++) {
            count += countWithStart(commands, i);
        }

        out.write(count).ln();
    }

    private static int countWithStart(char[] commands, int start) {
        int count = 0;
        int u = 0, d = 0, r = 0, l = 0;
        for (int i = start; i < commands.length; i++) {
            char c = commands[i];
            if (c == 'U') u++;
            else if (c == 'D') d++;
            else if (c == 'R') r++;
            else l++;
            if (u == d && r == l)
                count++;
        }
        return count;
    }

    public static class IO {
        public static final In in = new In(new BufferedReader(new InputStreamReader(System.in)));
        public static final Out out = new Out(new BufferedWriter(new OutputStreamWriter(System.out)));

        public static class In {
            private BufferedReader reader;
            StringTokenizer tokener;

            public In(BufferedReader reader) {
                this.reader = reader;
            }

            public String word() {
                try {
                    if (tokener == null || !tokener.hasMoreTokens())
                        tokener = new StringTokenizer(reader.readLine());
                    return tokener.nextToken();
                }
                catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            public int int1() {
                return Integer.parseInt(word());
            }

            public long long1() {
                return Long.parseLong(word());
            }

            public String[] words(int n) {
                String[] result = new String[n];
                for (int i = 0; i < n; i++)
                    result[i] = word();
                return result;
            }

            public int[] ints(int n) {
                int[] result = new int[n];
                for (int i = 0; i < n; i++)
                    result[i] = Integer.parseInt(word());
                return result;
            }

            public long[] longs(int n) {
                long[] result = new long[n];
                for (int i = 0; i < n; i++)
                    result[i] = Long.parseLong(word());
                return result;
            }
        }

        public static class Out {
            private BufferedWriter writer;
            private boolean isEmptyLine = true;

            public Out(BufferedWriter writer) {
                this.writer = writer;
            }

            private Out write(String str) {
                try {
                    if (!isEmptyLine)
                        writer.write(" ");
                    else
                        isEmptyLine = false;
                    writer.write(str);
                    return this;
                }
                catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            public Out ln() {
                try {
                    writer.newLine();
                    writer.flush();
                    isEmptyLine = true;
                    return this;
                }
                catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            public Out write(Object obj) {
                return write(obj.toString());
            }

            public Out write(int num) {
                return write(Integer.toString(num));
            }

            public Out write(long num) {
                return write(Long.toString(num));
            }

            public Out write(Object[] objs) {
                for (Object obj : objs)
                    write(obj);
                return this;
            }

            public <T> Out write(Iterable<T> iter) {
                for (T obj : iter)
                    write(obj);
                return this;
            }

            public Out write(int[] nums) {
                for (int num : nums)
                    write(num);
                return this;
            }

            public Out write(long[] nums) {
                for (long num : nums)
                    write(num);
                return this;
            }
        }
    }
}
