#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1 << 62;
const long long MOD = 1e9 + 7;
const int iINF = 1 << 30;
const double PI = 3.14159265359;
void test_case() {
  int n;
  vector<int> a;
  vector<pair<int, int> > b;
  cin >> n;
  a.resize(2 * n);
  int init[] = {0, 0};
  for (int i = 0; i < 2 * n; i++) {
    cin >> a[i];
    a[i]--;
    init[a[i]]++;
  }
  int curr[] = {0, 0};
  for (int i = n - 1; i >= 0; i--) {
    curr[a[i]]++;
    b.push_back({curr[0] - curr[1], n - 1 - i});
  }
  b.push_back({0, -1});
  sort(b.begin(), b.end());
  curr[0] = curr[1] = 0;
  int id =
      lower_bound(b.begin(), b.end(),
                  make_pair(init[0] - init[1] + curr[1] - curr[0], -iINF)) -
      b.begin();
  int ans = iINF;
  if (id != n + 1 && b[id].first == init[0] - init[1] + curr[1] - curr[0])
    ans = min(ans, b[id].second + 1);
  for (int i = n; i < 2 * n; i++) {
    curr[a[i]]++;
    id = lower_bound(b.begin(), b.end(),
                     make_pair(init[0] - init[1] + curr[1] - curr[0], -iINF)) -
         b.begin();
    if (id != n + 1 && b[id].first == init[0] - init[1] + curr[1] - curr[0])
      ans = min(ans, b[id].second + 1 + i - n + 1);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    test_case();
  }
  return 0;
}
