#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, i;
  cin >> n;
  long long a[2 * n + 1], one = 0, two = 0, dpone[2 * n + 1], dptwo[2 * n + 1];
  memset(dpone, 0, sizeof(dpone));
  memset(dptwo, 0, sizeof(dptwo));
  for (i = 1; i <= 2 * n; i++) {
    cin >> a[i];
    one += ((a[i] == 1) ? 1 : 0);
    two += ((a[i] == 2) ? 1 : 0);
  }
  if (one == two) {
    cout << "0\n";
    return;
  }
  dpone[n] = ((a[n] == 1) ? 1 : 0);
  dptwo[n] = ((a[n] == 2) ? 1 : 0);
  for (i = n - 1; i >= 1; i--) {
    dpone[i] = dpone[i + 1] + ((a[i] == 1) ? 1 : 0);
    dptwo[i] = dptwo[i + 1] + ((a[i] == 2) ? 1 : 0);
  }
  dpone[n + 1] = ((a[n + 1] == 1) ? 1 : 0);
  dptwo[n + 1] = ((a[n + 1] == 2) ? 1 : 0);
  for (i = n + 2; i <= 2 * n; i++) {
    dpone[i] = dpone[i - 1] + ((a[i] == 1) ? 1 : 0);
    dptwo[i] = dptwo[i - 1] + ((a[i] == 2) ? 1 : 0);
  }
  map<long long, set<long long> > l, r;
  set<long long>::iterator ii;
  for (i = 1; i <= n; i++) l[dpone[i] - dptwo[i]].insert(n - i + 1);
  for (i = n + 1; i <= 2 * n; i++) r[dpone[i] - dptwo[i]].insert(i - n);
  long long ans = 2 * n;
  for (i = n; i >= 1; i--) {
    long long curone = one - dpone[i], curtwo = two - dptwo[i],
              raz = curone - curtwo;
    if (curone == curtwo) ans = min(ans, n - i + 1);
    if (r[raz].size() > 0) {
      ii = r[raz].begin();
      ans = min(ans, n - i + 1 + (*ii));
    } else
      continue;
  }
  for (i = n + 1; i <= 2 * n; i++) {
    long long curone = one - dpone[i], curtwo = two - dptwo[i],
              raz = curone - curtwo;
    if (curone == curtwo) ans = min(ans, i - n);
    if (l[raz].size() > 0) {
      ii = l[raz].begin();
      ans = min(ans, i - n + (*ii));
    } else
      continue;
  }
  cout << ans << "\n";
}
int main() {
  long long n;
  cin >> n;
  while (n--) solve();
  return 0;
}
