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!
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.
none
4
LDUR
4
5
RRRUU
0
6
LLRRRR
4
88
LLUUULRDRRURDDLURRLRDRLLRULRUUDDLLLLRRDDURDURRLDURRLDRRRUULDDLRRRDDRRLUULLURDURUDDDDDLDR
76
89
LDLLLDRDUDURRRRRUDULDDDLLUDLRLRLRLDLDUULRDUDLRRDLUDLURRDDRRDLDUDUUURUUUDRLUDUDLURDLDLLDDU
80
90
RRRDUULLLRDUUDDRLDLRLUDURDRDUUURUURDDRRRURLDDDUUDRLLLULURDRDRURLDRRRRUULDULDDLLLRRLRDLLLLR
84
91
RLDRLRRLLDLULULLURULLRRULUDUULLUDULDUULURUDRUDUURDULDUDDUUUDRRUUDLLRULRULURLDRDLDRURLLLRDDD
76
92
RLRDDLULRLLUURRDDDLDDDLDDUURRRULLRDULDULLLUUULDUDLRLRRDRDRDDULDRLUDRDULDRURUDUULLRDRRLLDRLRR
86
93
RLLURLULRURDDLUURLUDDRDLUURLRDLRRRDUULLRDRRLRLDURRDLLRDDLLLDDDLDRRURLLDRUDULDDRRULRRULRLDRDLR
84
94
RDULDDDLULRDRUDRUUDUUDRRRULDRRUDURUULRDUUDLULLLUDURRDRDLUDRULRRRULUURUDDDDDUDLLRDLDRLLRUUURLUL
86
95
RDLUUULLUURDDRLDLLRRRULRLRDULULRULRUDURLULDDDRLURLDRULDUDUUULLRDDURUULULLDDLDRDRLLLURLRDLLDDDDU
86
96
RDDRLRLLDDULRLRURUDLRLDUDRURLLUUDLLURDLRRUURDRRUDRURLLDLLRDURDURLRLUDURULLLRDUURULUUULRRURRDLURL
84
97
RURDDLRLLRULUDURDLRLLUUDURRLLUDLLLDUDRUULDRUUURURULRDLDRRLLUUUDLLLDDLLLLRLLDUDRRDLLUDLRURUDULRLUR
82
98
RUDURLULLDDLLRDLLRDDLLLLRLDDDDRRRDDRRURLDRLLRUUUDLUUUDDDUDRUURLURUUDUUDRULRRULLRRLRULLULDLUURLULRD
92
99
RRULLDULRRDRULLDUDRUDDDRLLUUDRDDUDURLDDRUUDRRUUURRRURDDLDUURDLRLURRDDLUDDLUDURDRUDDURLURURLRUDRURLD
86
100
UDRLRRLLRRLRRRDDLLDDDLULLDDLURUURUULUDDDRDDLLRDLLUURLRDRLRRLRLLLULDUDDUURRLRDULDRDURRRRRRULDRRDLDRRL
88
1
U
0
5
UUULD
2
1
D
0
5
URLUL
2
5
DDDRU
2
2
LR
2
8
DDRDLDUR
4
6
LLLLUD
2
13
RRRLLLLLLLLLL
6
from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
#from functools import lru_cache   #use @lru_cache(None)
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')
#
def input(): return sys.stdin.readline()
def mapi(arg=0): return map(int if arg==0 else str,input().split())
#------------------------------------------------------------------

n = int(input())
a = input().strip()
res =0
x = 0
y =0
cnt = 0
vis =defaultdict(int)
vis[(0,0)] = 0
for i in a:
    if i=="L": x-=1
    if i=="R": x+=1
    if i=="D": y-=1
    if i=="U": y+=1
    if (x,y) not in vis:
        vis[(x,y)] = cnt
    else:
        res = max(res,cnt-vis[(x,y)]+1)
    cnt+=1

print(res)
