Karlsson has recently discovered a huge stock of berry jam jars in the basement of the house. More specifically, there were $2n$ jars of strawberry and blueberry jam.

All the $2n$ jars are arranged in a row. The stairs to the basement are exactly in the middle of that row. So when Karlsson enters the basement, he sees exactly $n$ jars to his left and $n$ jars to his right.

For example, the basement might look like this: [Image] 

Being the starightforward man he is, he immediately starts eating the jam. In one minute he chooses to empty either the first non-empty jar to his left or the first non-empty jar to his right.

Finally, Karlsson decided that at the end the amount of full strawberry and blueberry jam jars should become the same.

For example, this might be the result: [Image] He has eaten $1$ jar to his left and then $5$ jars to his right. There remained exactly $3$ full jars of both strawberry and blueberry jam. 

Jars are numbered from $1$ to $2n$ from left to right, so Karlsson initially stands between jars $n$ and $n+1$.

What is the minimum number of jars Karlsson is required to empty so that an equal number of full strawberry and blueberry jam jars is left?

Your program should answer $t$ independent test cases.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases.

The first line of each test case contains a single integer $n$ ($1 \le n \le 10^5$).

The second line of each test case contains $2n$ integers $a_1, a_2, \dots, a_{2n}$ ($1 \le a_i \le 2$) — $a_i=1$ means that the $i$-th jar from the left is a strawberry jam jar and $a_i=2$ means that it is a blueberry jam jar.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.


-----Output-----

For each test case print the answer to it — the minimum number of jars Karlsson is required to empty so that an equal number of full strawberry and blueberry jam jars is left.


-----Example-----
Input
4
6
1 1 1 2 2 1 2 1 2 1 1 2
2
1 2 1 2
3
1 1 1 1 1 1
2
2 1 1 1

Output
6
0
6
2



-----Note-----

The picture from the statement describes the first test case.

In the second test case the number of strawberry and blueberry jam jars is already equal.

In the third test case Karlsson is required to eat all $6$ jars so that there remain $0$ jars of both jams.

In the fourth test case Karlsson can empty either the second and the third jars or the third and the fourth one. The both scenarios will leave $1$ jar of both jams.

Starter code:

Solutions:
for tcase in range(int(input())):
    n=int(input())
    ls = list(map(int, input().split()))
    oneneed = 2*(n - ls.count(1))
    ldct = {0:0}
    ctr = 0
    eaten = 0
    for i in range(n-1,-1,-1):
        eaten += 1
        ctr += (1 if ls[i] == 2 else -1)
        if ctr not in ldct:
            ldct[ctr] = eaten

    rdct = {0:0}
    ctr = 0
    eaten = 0
    for i in range(n,2*n):
        eaten += 1
        ctr += (1 if ls[i] == 2 else -1)
        if ctr not in rdct:
            rdct[ctr] = eaten
    #print(oneneed, ldct, rdct)

    best=99**99
    for k in list(rdct.keys()):
        otk = oneneed - k
        if otk in ldct:
            best = min(best, rdct[k]+ldct[otk])
    print(best)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    red = a.count(1)
    blue = 2*n - red
    s = red-blue
    if s == 0:
        print(0)
        return

    cur = 0
    d = {0:0}
    for i in range(n, 2*n):
        if a[i] == 2:
            cur -= 1
        else:
            cur += 1
        if cur not in d:
            d[cur] = i-n+1
    ans = float("inf")
    need = s
    cur = 0
    if need in d:
        ans = min(ans, d[need])
    for i in reversed(list(range(n))):
        if a[i] == 2:
            cur -= 1
        else:
            cur += 1
        if need-cur in d:
            ans = min(ans, d[need-cur]+n-i)
    print(ans)

t = int(input())
for i in range(t):
    solve()



import sys
input = sys.stdin.readline
for _ in range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))
    a, b = a[n - 1::-1], a[n:]
    ma, mb = {0: 0}, {0: 0}
    pa = pb = 0
    for i in range(n):
        pa += 1 if a[i] == 1 else -1
        pb += 1 if b[i] == 1 else -1
        if pa not in ma:
            ma[pa] = i + 1
        if pb not in mb:
            mb[pb] = i + 1
    total = pa + pb
    ans = 10 ** 9
    for da, va in list(ma.items()):
        req = total - da
        if req in mb:
            ans = min(ans, va + mb[req])
    print(ans)


from math import *
for _ in range(int(input())):
	n=int(input())
	a=list(map(int,input().split()))
	z=a.count(1)-a.count(2)
	c=a[:n]
	d=a[n:]
	jk={0:0}
	b=0
	for i in range(n):
		x=d[i]
		if x==1:
			b-=1
		else:
			b+=1
		if b not in jk:
			jk[b]=i+1
	ans=1000000
	b=0
	i=1
	if z==0:
		ans=0
	for x in c[::-1]:
		if x==1:
			b-=1
		else:
			b+=1
		if -z-b in jk:
			ans = min(ans,i+jk[-z-b])
		i+=1
	if -z in jk:
		ans=min(ans,jk[-z])
	print(ans)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return list(map(int,minp().split()))

def solve():
	n = mint()
	a = list(mints())
	c = dict()
	c[0] = 2*n
	d = 0
	#print(d, end=' ')
	for i in range(2*n-1,n-1,-1):
		if a[i] == 1:
			d += 1
		else:
			d -= 1
		#print(d, i-n, end=' ')
		c[d] = i
	#print()
	d = 0
	r = 2*n
	r = min(r, n + c[0] - n)
	for i in range(n):
		if a[i] == 1:
			d += 1
		else:
			d -= 1
		#print(d, n-i-1, end=' ')
		if (-d) in c:
			r = min(r, n - i - 1 + c[-d] - n)
	#print()
	return r


for i in range(mint()):
	print(solve())


def inp(ai):
    cur = sum(ai) * 2 - n * 3
    yield cur
    for aii in ai:
        if aii == 1:
            cur += 1
        else:
            cur -= 1
        yield cur


def inp2(ii):
    ans = {}
    for i, iii in enumerate(ii):
        if iii not in ans:
            ans[iii] = i
    return ans


for _ in range(int(input())):
    n = int(input())
    a = iter(map(int, input().split()))
    a1 = [next(a) for _ in range(n)]
    a1.reverse()
    a2 = list(a)
    i1 = inp2(inp(a1))
    i2 = inp2((-i2i for i2i in inp(a2)))
    res = n * 2
    for k in list(i1.keys()):
        if k in list(i2.keys()):
            res = min(res, i1[k] + i2[k])
    print(res)


q = int(input())
for rwier in range(q):
	n = int(input())
	l = list(map(int,input().split()))
	j = l.count(1)
	d = l.count(2)
	pr = [0] * n
	le = [0] * n
	pr[0] = (1 if l[n] == 1 else -1)
	le[0] = (1 if l[n-1] == 1 else -1)
	for i in range(1, n):
		pr[i] = pr[i-1] + (1 if l[n+i] == 1 else -1)
		le[i] = le[i-1] + (1 if l[n-i-1] == 1 else -1)
	#print(pr,le)
	if j - d < 0:
		for i in range(n):
			pr[i] = -pr[i]
			le[i] = -le[i]
	ab = abs(j-d)
	if ab == 0:
		print(0)
	else:
		#suma = abs
		najwp = [123456789] * (2*n+1)
		najwl = [123456789] * (2*n+1)
		le = [0] + le
		pr = [0] + pr
		for i in range(n+1):
			if pr[i] >= 0 and najwp[pr[i]] == 123456789:
				najwp[pr[i]] = i
			if le[i] >= 0 and najwl[le[i]] == 123456789:
				najwl[le[i]] = i
		wyn = 41343443143
		for i in range(ab+1):
			if najwp[i] + najwl[ab-i] < wyn:
				wyn = najwp[i] +najwl[ab-i]
		print(wyn)


import itertools
from collections import defaultdict

t = int(input())

for _ in range(t):
    n = int(input())
    
    a = list(map(int, input().split()))
    
    ones = a.count(1)
    twos = a.count(2)
    
    a1 = a[:n][::-1]
    a2 = a[n:]
    
    target = ones - twos
    
    a1 = [[-1,1][x==1]for x in a1]
    a1 = [0] + list(itertools.accumulate(a1))
    a2 = [[-1,1][x==1]for x in a2]
    a2 = [0] + list(itertools.accumulate(a2))
    
    a2v = defaultdict(lambda: 2*n+1)
    for i2, x2 in enumerate(a2):
        a2v[x2] = min(a2v[x2], i2)
    best = 2*n
    
    for i1, x1 in enumerate(a1):
        best = min(best, i1+a2v[target-x1])
    
    print(best)


import sys
input = sys.stdin.readline

t=int(input())

for test in range(t):
    n=int(input())
    A=list(map(int,input().split()))

    LEFT=[0]
    RIGHT=[0]

    for a in A[:n]:
        if a==1:
            LEFT.append(LEFT[-1]+1)
        else:
            LEFT.append(LEFT[-1]-1)

    for a in A[n:][::-1]:
        if a==1:
            RIGHT.append(RIGHT[-1]+1)
        else:
            RIGHT.append(RIGHT[-1]-1)

    #print(LEFT)
    #print(RIGHT)
    #print()

    MAXLEFT=[-1]*(2*n+1)
    MAXRIGHT=[-1]*(2*n+1)

    for i in range(n+1):
        MAXLEFT[LEFT[i]+n]=i
        MAXRIGHT[RIGHT[i]+n]=i
   
    #print(MAXLEFT)
    #print(MAXRIGHT)
    #print()

    ANS=0
    for i in range(2*n+1):
        if MAXLEFT[i]==-1 or MAXRIGHT[2*n-i]==-1:
            continue
        ANS=max(ANS,MAXLEFT[i]+MAXRIGHT[2*n-i])

    #print(ANS)
    print(2*n-ANS)

    
    

    

    
    


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None]*T
inf = 10**9+7
for qu in range(T):
    N = int(readline())
    A = list(map(int, readline().split()))
    bj = A.count(1)
    sj = 2*N-bj
    x = sj-bj
    A1 = [3-2*a for a in A[:N][::-1]]
    A2 = [3-2*a for a in A[N:]]          
    for i in range(1, N):
        A1[i] += A1[i-1]
        A2[i] += A2[i-1]
    geta = -min(0, min(A2))+1
    mA = max(0, max(A2))
    idx = [inf]*(mA+geta+1)
    idx[geta+0] = 0
    for i in range(N):
        a2 = A2[i]
        idx[geta+a2] = min(idx[geta+a2], i+1)
    
    ans = inf
    A1 = [0]+A1
    for i in range(N+1):
        a1 = A1[i]
        if -geta <= -a1-x <= mA:
            ans = min(ans, i+idx[geta-a1-x])
    Ans[qu] = ans
print('\n'.join(map(str, Ans)))