#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const double pi = acos(-1.0);
const int inf = 0x7f7f7f7f;
const int mod = 1e9 + 7;
const int N = 2e6 + 5;
int n, m, t;
int i, j, k;
int a[N];
map<int, int> pos;
int sum[N];
void go(int x, int y) {
  if (x == y) {
    cout << 0 << endl;
    return;
  }
  if (x == 0) {
    cout << y << endl;
    return;
  }
  if (y == 0) {
    cout << x << endl;
    return;
  }
  int ans = inf;
  for (int i = n; i <= (n << 1); i++) {
    int tmp = sum[i] - sum[n << 1];
    if (pos.find(tmp) != pos.end()) ans = min(ans, i - pos[tmp]);
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    int have1 = 0, have2 = 0;
    pos.clear();
    memset(sum, 0, sizeof sum);
    pos[0] = 0;
    for (i = 1; i <= 2 * n; i++) {
      cin >> a[i];
      if (a[i] == 1)
        have1++;
      else {
        have2++;
        a[i] = -1;
      }
      sum[i] = sum[i - 1] + a[i];
      if (i <= n) pos[sum[i]] = i;
    }
    go(have1, have2);
  }
  return 0;
}
