#include <bits/stdc++.h>
using namespace std;
long long int inf = (1e18 + 2);
vector<long long int> getUniqs(vector<long long int> vec) {
  sort((vec).begin(), (vec).end());
  auto itr = unique((vec).begin(), (vec).end());
  vec.resize(distance(vec.begin(), itr));
  return vec;
}
long long int ceill(long long int N, long long int K) {
  long long int res = N / K;
  long long int rem = N % K;
  if (rem != 0) res++;
  return res;
}
long long int modExp(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int tstt;
  cin >> tstt;
  for (long long int qq = 0; qq < tstt; qq++) {
    long long int n;
    cin >> n;
    long long int minn = 2 * n;
    long long int a[2 * n + 2];
    for (long long int i = 1; i < 2 * n + 1; i++) cin >> a[i];
    long long int diff1[n + 1];
    diff1[0] = 0;
    map<long long int, long long int> m;
    long long int b = 0, s = 0;
    for (long long int i = 1; i < n + 1; i++) {
      if (a[i] == 1)
        s++;
      else
        b++;
      diff1[i] = b - s;
    }
    s = 0;
    b = 0;
    for (long long int i = 2 * n; i >= n + 1; i--) {
      if (a[i] == 1)
        s++;
      else
        b++;
      if (m.find(b - s) == m.end())
        m.insert(make_pair(b - s, i - n - 1));
      else
        m[b - s] = i - n - 1;
    }
    if (m.find((long long int)0) == m.end())
      m.insert(make_pair((long long int)0, n));
    for (long long int l = 0; l < n + 1; l++) {
      long long int d = diff1[n - l];
      if (m.find(-d) == m.end()) continue;
      minn = min(minn, l + m[-d]);
    }
    cout << minn << endl;
  }
  return 0;
}
