#include <bits/stdc++.h>
using namespace std;
long long t, n, lr, lb, rr, rb, k, mi, p;
vector<long long> v, rcb, lc;
vector<pair<long long, long long> > rc;
int main() {
  cin >> t;
  for (long long j = 0; j < t; j++) {
    cin >> n;
    lr = 0;
    lb = 0;
    rr = 0;
    rb = 0;
    mi = 2 * n;
    v.clear();
    rc.clear();
    lc.clear();
    rcb.clear();
    for (long long i = 0; i < n; i++) {
      lc.push_back(lr - lb);
      cin >> k;
      if (k % 2)
        lr++;
      else
        lb++;
    }
    lc.push_back(lr - lb);
    for (long long i = 0; i < n; i++) {
      cin >> k;
      if (k % 2) {
        rr++;
        v.push_back(1);
      } else {
        rb++;
        v.push_back(-1);
      }
    }
    rc.push_back(make_pair(rr - rb, 0));
    for (long long i = 0; i < n; i++)
      rc.push_back(make_pair(rc[i].first - v[i], i + 1));
    sort(rc.begin(), rc.end());
    for (long long i = 0; i <= n; i++) {
      rcb.push_back(rc[i].first);
    }
    for (long long i = 0; i <= n; i++) {
      p = (lower_bound(rcb.begin(), rcb.end(), -1 * lc[i]) - rcb.begin());
      if (p <= n && p >= 0)
        if (n - i + rc[p].second < mi && rcb[p] == -1 * lc[i])
          mi = n - i + rc[p].second;
    }
    cout << mi << endl;
  }
}
