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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Objects;
import java.util.Random;
import java.lang.*;

public class Solver {

InputReader in;
Printer out;

long MOD = 1000000007;

public void startTask() throws Exception {
	int m = in.nextInt();
	String ins = in.nextString();
	int n = ins.length();
	int x=0,y=0;
	int[] xs = new int[n+1]; 
	int[] ys = new int[n+1]; 
// 	out.println(ins);

	xs[0]=0;
	ys[0]=0;
	
// 	if(ins.charAt(0)=='U')ys[0]=++y;
// 	else if (ins.charAt(0)=='D')ys[0]=--y;
// 	else if (ins.charAt(0)=='R')xs[0]=++x;
// 	else if (ins.charAt(0)=='L')xs[0]=--x;	

	for (int i=0; i<n; i++) {
		xs[i+1]=xs[i];
		ys[i+1]=ys[i];
		if(ins.charAt(i)=='U')ys[i+1]=++y;
		else if (ins.charAt(i)=='D')ys[i+1]=--y;
		else if (ins.charAt(i)=='R')xs[i+1]=++x;
		else if (ins.charAt(i)=='L')xs[i+1]=--x;	
	}
	int c=0;
	for (int i=0; i<n+1; i++) {
		for (int j=i+1; j<n+1; j++) {
			if(xs[i]==xs[j] && ys[i]==ys[j]){
				c++;
// 				out.println("i j = "+ i +" " +j);
			}
		}	
	}
    
	out.println(c);
}

public static void main(String[] args) throws Exception {
	InputReader in;
	PrintStream out;

	//in = new InputReader(new FileInputStream(new File("in.txt")));
	//out = new PrintStream("out.txt");
	in = new InputReader(System.in);
	out = System.out;

	Solver main = new Solver();

	main.in = in;
	main.out = new Printer(out,true); // true for autoFlush

	main.startTask();
	
	out.flush();
}

private static class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1) {
		throw new InputMismatchException();
		}
		if (curChar >= numChars) {
		curChar = 0;
		try {
			numChars = stream.read(buf);
		} catch (IOException e) {
			throw new InputMismatchException();
		}
		if (numChars <= 0) {
			return -1;
		}
		}
		return buf[curChar++];
	}

	public int nextInt() {
		int c = read();
		while (isSpaceChar(c)) {
		c = read();
		}
		int sgn = 1;
		if (c == '-') {
		sgn = -1;
		c = read();
		}
		int res = 0;
		do {
		if (c < '0' || c > '9') {
			throw new InputMismatchException();
		}
		res *= 10;
		res += c - '0';
		c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String nextString() {
		int c = read();
		while (isSpaceChar(c)) {
		c = read();
		}
		StringBuilder res = new StringBuilder();
		do {
		res.appendCodePoint(c);
		c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public double nextDouble() {
		int c = read();
		while (isSpaceChar(c)) {
		c = read();
		}
		int sgn = 1;
		if (c == '-') {
		sgn = -1;
		c = read();
		}
		double res = 0;
		while (!isSpaceChar(c) && c != '.') {
		if (c == 'e' || c == 'E') {
			return res * Math.pow(10, nextInt());
		}
		if (c < '0' || c > '9') {
			throw new InputMismatchException();
		}
		res *= 10;
		res += c - '0';
		c = read();
		}
		if (c == '.') {
		c = read();
		double m = 1;
		while (!isSpaceChar(c)) {
			if (c == 'e' || c == 'E') {
				return res * Math.pow(10, nextInt());
			}
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			m /= 10;
			res += (c - '0') * m;
			c = read();
		}
		}
		return res * sgn;
	}

	public long nextLong() {
		int c = read();
		while (isSpaceChar(c)) {
		c = read();
		}
		int sgn = 1;
		if (c == '-') {
		sgn = -1;
		c = read();
		}
		long res = 0;
		do {
		if (c < '0' || c > '9') {
			throw new InputMismatchException();
		}
		res *= 10;
		res += c - '0';
		c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public boolean isSpaceChar(int c) {
		if (filter != null) {
		return filter.isSpaceChar(c);
		}
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return nextString();
	}

	public interface SpaceCharFilter {

		public boolean isSpaceChar(int ch);
	}
}

private static class Printer {

	PrintStream out;
	StringBuilder buffer = new StringBuilder();
	boolean autoFlush;

	public Printer(PrintStream out) {
		this.out = out;
	}

	public Printer(PrintStream out, boolean autoFlush) {
		this.out = out;
		this.autoFlush = autoFlush;
	}

	public void println() {
		buffer.append("\n");

		if (autoFlush) {
		flush();
		}
	}

	public void println(int n) {
		println(Integer.toString(n));
	}

	public void println(long n) {
		println(Long.toString(n));
	}

	public void println(double n) {
		println(Double.toString(n));
	}

	public void println(float n) {
		println(Float.toString(n));
	}

	public void println(boolean n) {
		println(Boolean.toString(n));
	}

	public void println(char n) {
		println(Character.toString(n));
	}

	public void println(byte n) {
		println(Byte.toString(n));
	}

	public void println(short n) {
		println(Short.toString(n));
	}

	public void println(Object o) {
		println(o.toString());
	}

	public void println(Object[] o) {
		println(Arrays.deepToString(o));
	}

	public void println(String s) {
		buffer.append(s).append("\n");

		if (autoFlush) {
		flush();
		}
	}

	public void print(char s) {
		buffer.append(s);

		if (autoFlush) {
		flush();
		}
	}

	public void print(String s) {
		buffer.append(s);

		if (autoFlush) {
		flush();
		}
	}

	public void flush() {
		try {
		BufferedWriter log = new BufferedWriter(new OutputStreamWriter(out));
		log.write(buffer.toString());

		log.flush();
		buffer = new StringBuilder();
		} catch (Exception e) {
		e.printStackTrace();
		}
	}
}

}