#include <bits/stdc++.h>
using namespace std;
inline void solve() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    n = 2 * n;
    vector<int> v(n);
    for (int i = 0; i < (n); i++) cin >> v[i];
    vector<int> pref(n + 2, 0);
    vector<int> suff(n + 2, 0);
    pref[0] = 0;
    for (int i = 1; i < (n / 2 + 1); i++)
      pref[i] = pref[i - 1] + (v[i - 1] == 1 ? 1 : -1);
    suff[n + 1] = 0;
    map<int, set<int>> mp;
    mp[suff[n + 1]].insert(n + 1);
    for (int i = n + 1 - 1; i >= n / 2 + 1; i--) {
      suff[i] = suff[i + 1] + (v[i - 1] == 1 ? 1 : -1);
      mp[suff[i]].insert(i);
    }
    int otv = n + 3;
    for (int i = 0; i < (n / 2 + 1); i++) {
      auto ub = mp[-pref[i]].upper_bound(i);
      if (ub != mp[-pref[i]].end()) {
        otv = min(otv, *ub - i);
      }
    }
    cout << otv - 1 << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
}
