#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename T>
T getint() {
  T val = 0;
  char c;
  bool neg = false;
  while ((c = getchar()) && !(c >= '0' && c <= '9')) {
    neg |= c == '-';
  }
  do {
    val = (val * 10) + c - '0';
  } while ((c = getchar()) && (c >= '0' && c <= '9'));
  return val * (neg ? -1 : 1);
}
int n, t;
int a[200000];
int s1[100000];
pair<int, int> s2[100000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 0; i < 2 * n; ++i) {
      cin >> a[i];
      if (a[i] == 2) a[i] = -1;
    }
    s1[0] = a[n - 1];
    for (int i = n - 2; i >= 0; --i) s1[n - i - 1] = a[i] + s1[n - i - 2];
    s2[0] = {a[n], 0};
    for (int i = 1; i < n; ++i) {
      s2[i].first = s2[i - 1].first + a[i + n];
      s2[i].second = i;
    }
    int d = s1[n - 1] + s2[n - 1].first;
    if (d == 0) {
      cout << 0 << '\n';
      continue;
    }
    sort(s2, s2 + n);
    int ans = 1000000000;
    auto itr = lower_bound(s2, s2 + n, make_pair(d, 0));
    if (itr != s2 + n && itr->first == d) ans = min(ans, itr->second + 1);
    for (int i = 0; i < n; ++i) {
      int target = d - s1[i];
      if (target == 0) {
        ans = min(ans, i + 1);
      } else {
        auto itr = lower_bound(s2, s2 + n, make_pair(target, 0));
        if (itr != s2 + n && itr->first == target)
          ans = min(ans, i + itr->second + 2);
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
