#include <bits/stdc++.h>
using namespace std;
map<int, int> p;
int n, f[200100], a[200100], t;
void solve() {
  p.clear();
  int res = INT_MAX;
  for (int i = 1; i <= 2 * n; i++) f[i] = f[i - 1] + a[i];
  if (f[2 * n] == 0) {
    cout << 0 << "\n";
    return;
  }
  for (int i = 1; i < n; i++) p[f[i]] = i;
  int sl = f[2 * n];
  for (int i = n; i <= 2 * n; i++) {
    if ((f[i] - sl) == 0) {
      res = min(res, i - p[(f[i] - sl)]);
    } else {
      if (p[(f[i] - sl)] != 0) {
        res = min(res, i - p[(f[i] - sl)]);
      }
    }
    if (i == n) p[f[n]] = n;
  }
  cout << res << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= 2 * n; i++) {
      cin >> a[i];
      if (a[i] == 2) a[i] = -1;
    }
    solve();
  }
}
