Ivan has a robot which is situated on an infinite grid. Initially the robot is standing in the starting cell (0, 0). The robot can process commands. There are four types of commands it can perform:  U — move from the cell (x, y) to (x, y + 1);  D — move from (x, y) to (x, y - 1);  L — move from (x, y) to (x - 1, y);  R — move from (x, y) to (x + 1, y). 

Ivan entered a sequence of n commands, and the robot processed it. After this sequence the robot ended up in the starting cell (0, 0), but Ivan doubts that the sequence is such that after performing it correctly the robot ends up in the same cell. He thinks that some commands were ignored by robot. To acknowledge whether the robot is severely bugged, he needs to calculate the maximum possible number of commands that were performed correctly. Help Ivan to do the calculations!


-----Input-----

The first line contains one number n — the length of sequence of commands entered by Ivan (1 ≤ n ≤ 100).

The second line contains the sequence itself — a string consisting of n characters. Each character can be U, D, L or R.


-----Output-----

Print the maximum possible number of commands from the sequence the robot could perform to end up in the starting cell.


-----Examples-----
Input
4
LDUR

Output
4

Input
5
RRRUU

Output
0

Input
6
LLRRRR

Output
4

Difficulty: interview

Starter code:

Solutions:
'''input
6
LLRRRR
'''
n = int(input())
s = input()
h, v = min(s.count("L"), s.count("R")), min(s.count("U"), s.count("D"))
print(2*h + 2*v)

n = int(input())

ops = input()

l = ops.count('L')
r = ops.count('R')
u = ops.count('U')
d = ops.count('D')

print(min(l,r)*2+min(u,d)*2)

n=int(input())
instructions=input()
left=0
right=0
up=0
down=0
for i in instructions:
  if i=="L":
    left+=1
  elif i=="R":
    right+=1
  elif i=="U":
    up+=1
  elif i=="D":
    down+=1
print((min(left,right)+min(up,down))*2)

n = int(input())
s = input()
d = {'L': (-1, 0), 'U': (0, 1), 'D': (0, -1), 'R': (1, 0)}

u, v = 0, 0

for c in s:
	u += d[c][0]
	v += d[c][1]

print(n - abs(u) - abs(v))


n=int(input())
a=input()
l=[a.count('L'),a.count('R'),a.count('D'),a.count('U')]
print(min(l[0],l[1])*2+min(l[2],l[3])*2)


n = int(input())
a = input()
x, y = 0, 0
for i in range(n):
	if a[i] == 'U':
		y += 1
	elif a[i] == 'D':
		y -= 1
	elif a[i] == 'L':
		x -= 1
	elif a[i] == 'R':
		x += 1
print(n - (abs(x) + abs(y)))


##n, m = map(int, input().split())
n = int(input())
s = input()
x = 0
y = 0
for i in range(n):
    if s[i] == "U":
        y += 1
    if s[i] == "D":
        y-= 1
    if s[i] == "L":
        x -= 1
    if s[i] == "R":
        x += 1
ans = n - abs(x) - abs(y)
print(max(0, ans))


n = int(input())
a = list(input().strip())
x = 0
y = 0
for i in range(n):
    if a[i] == 'L':
        x -= 1
    elif a[i] == 'R':
        x += 1
    elif a[i] == 'U':
        y -= 1
    elif a[i] == 'D':
        y += 1
print(max(0, n - abs(x) - abs(y)))

n=int(input())
s=input()

count=min(s.count('U'),s.count('D'))+min(s.count('L'),s.count('R'))
print(count*2)

n = int(input())
s = input()
x = [0 for i in range(4)]
for i in range(n):
	if s[i] == "U":
		x[0] += 1
	elif s[i] == "D":
		x[1] += 1
	elif s[i] == "L":
		x[2] += 1
	else:
		x[3] += 1
print(min(x[0], x[1]) * 2 + min(x[2], x[3]) * 2)		
		
		


n = int(input())
s = input()
k = 2 * (min(s.count('U'), s.count('D')) + min(s.count('L'), s.count('R')))
print(k)


from collections import Counter

num_moves = int(input())

move_count = Counter(input())

print(num_moves - abs(move_count['R'] - move_count['L']) - abs(move_count['U'] - move_count['D']))

x = int(input())
s = input()
ansl = 0
ansd = 0
for i in s:
    if i =="L":
        ansl += 1
    if i == "R":
        ansl -= 1
    if i == "D":
        ansd += 1
    if i == "U":
        ansd -= 1
ansl = abs(ansl)
ansd = abs(ansd)
print(x - (ansd+ansl))

n = int(input())
com = input()

print (min(com.count('L'), com.count('R')) * 2    +     min(com.count('U'), com.count('D')) * 2)

n = int(input())
a = [0] + list(input())
x, y = 0, 0
an = 0
ups, dwns, rts, lts = 0, 0, 0, 0
for i in range(n, 0, -1):
    if a[i] == 'U':
        ups += 1
    elif a[i] == 'D':
        dwns += 1
    elif a[i] == 'R':
        rts += 1
    else:
        lts += 1
    an = max(an, 2 * min(rts, lts) + 2 * min(ups, dwns))
print(an)


# -*- coding: utf-8 -*-

import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys

"""
created by shhuan at 2017/11/9 23:05

"""

N = int(input())
S = input()


u, d, l, r = S.count('U'), S.count('D'), S.count('L'), S.count('R')

print(N - abs(u-d) - abs(l-r))

from collections import Counter

n = int(input())
s = input()

d = Counter(s)


try:
    temp = min(d['U'], d['D'])
    d['U'] -= temp
    d['D'] -= temp
except KeyError:
    pass

try:
    temp = min(d['L'], d['R'])
    d['L'] -= temp
    d['R'] -= temp
except KeyError:
    pass

print(n - sum(list(d.values())))


n = int(input())
commands = input()
left = 0
right = 0
up = 0
down = 0
for i in commands:
    if i == 'U':
        up += 1
    elif i == 'D':
        down += 1
    elif i == 'R':
        right += 1
    elif i == 'L':
        left += 1
    else:
        raise ValueError
print(2*min(right, left) + 2*min(up, down))


n = int(input())
string = input()
arr = [str(i) for i in string][:n:]
left = right = up = down = 0
for i in arr:
	if i == 'L':
		left+=1
	elif i == 'R':
		right+=1
	elif i == 'U':
		up+=1
	elif i == 'D':
		down+=1
print(2*(min(left,right)+min(up,down)))
# print(left,right,up,down)
# print(arr)


n = int(input())
l = d = u = r = 0
ans = 0
for i in input():
    if i == "L":
        l += 1
    elif i == "D":
        d += 1
    elif i == "U":
        u += 1
    else:
        r += 1

ans += min(l, r) * 2
ans += min(u, d) * 2

print(ans)


n = int(input())
s = list(input())

d = 'UDLR'
cnt = {}
for c in d:
    cnt[c] = 0
for c in s:
    cnt[c] += 1
print(2 * (min(cnt['U'], cnt['D']) + min(cnt['L'], cnt['R'])))


t = int(input())
a = input()
l,r,d,u = 0,0,0,0
for i in a:
    if i == 'L': l+=1
    if i == 'R': r+=1
    if i == 'U': u+=1
    if i == 'D': d+=1
s = min(l,r)*2 + min(u,d)*2
print(s)

n = int(input())
s = input()

print(min([s.count('L'), s.count('R')]) * 2 + min([s.count('D'), s.count('U')]) * 2)

n = int(input())

cs = input()

cc = {'U': 0, 'D': 0, 'L': 0, 'R': 0}

for c in cs:
    cc[c] += 1


total = n - abs(cc['U']-cc['D']) - abs(cc['L']-cc['R'])
print(total)