#include <bits/stdc++.h>
using namespace std;
const int MAXI = int(1e9 + 123);
void solve() {
  int n;
  cin >> n;
  vector<int> nums(2 * n);
  int initd = 0;
  for (int i = 0; i < n * 2; i++) {
    cin >> nums[i];
    if (nums[i] == 1)
      initd--;
    else
      initd++;
  }
  if (initd == 0) {
    printf("0\n");
    return;
  }
  map<int, int> rd;
  int val = 0;
  for (int i = n; i < 2 * n; i++) {
    if (nums[i] == 1)
      val--;
    else
      val++;
    if (rd.find(val) == rd.end()) {
      rd[val] = i;
    }
  }
  int sz = MAXI;
  if (rd.find(initd) != rd.end()) {
    sz = rd[initd] + 1 - n;
  }
  int cnt = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (nums[i] == 1)
      cnt--;
    else
      cnt++;
    if (cnt == initd) {
      sz = min(sz, n - i);
    }
    int need = initd - cnt;
    if (rd.find(need) != rd.end()) {
      sz = min(sz, rd[need] - i + 1);
    }
  }
  printf("%i\n", sz);
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    solve();
  }
}
