#include <bits/stdc++.h>
using namespace std;
int main() {
  int cnt;
  cin >> cnt;
  for (int t = 0; t < cnt; t++) {
    int n;
    cin >> n;
    vector<int> le, ri;
    for (int i = 0; i < n * 2; i++) {
      int x;
      cin >> x;
      if (i < n)
        le.push_back(x);
      else
        ri.push_back(x);
    }
    vector<int> ple(le.size()), pri(ri.size());
    int sum = 0;
    map<int, int> mle, mri;
    for (int i = 0; i < n; i++) {
      sum += (le[i] == 1 ? 1 : -1);
      ple[i] = sum;
    }
    for (int i = le.size() - 1; i >= 0; i--) {
      if (mle.find(ple[i]) == mle.end()) mle[ple[i]] = le.size() - 1 - i;
    }
    sum = 0;
    for (int i = ri.size() - 1; i >= 0; i--) {
      sum += (ri[i] == 1 ? 1 : -1);
      pri[i] = sum;
    }
    for (int i = 0; i < ri.size(); i++) {
      if (mri.find(pri[i]) == mri.end()) mri[pri[i]] = i;
    }
    int ans = n * 2;
    if (mri.find(-ple.back()) != mri.end()) ans = min(ans, mri[-ple.back()]);
    if (mri.find(0) != mri.end()) ans = min(ans, n + mri[0]);
    if (mle.find(-pri.front()) != mle.end()) ans = min(ans, mle[-pri.front()]);
    if (mle.find(0) != mle.end()) ans = min(ans, n + mle[0]);
    for (int i = 1; i < le.size(); i++) {
      int k = ple[le.size() - 1 - i];
      if (mri.find(-k) != mri.end()) ans = min(ans, i + mri[-k]);
    }
    for (int i = 1; i < pri.size(); i++) {
      int k = pri[i];
      if (mle.find(-k) != mle.end()) ans = min(ans, i + mle[-k]);
    }
    cout << ans << endl;
  }
  return 0;
}
