#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;
template <class T, class U>
using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t-- > 0) {
    int n;
    cin >> n;
    V<int> a(2 * n);
    for (int i = 0; i < 2 * n; i++) cin >> a[i];
    int bjc = 0, rjc = 0;
    map<int, int> idxm;
    idxm[0] = -1;
    for (int i = 0; i < n; i++) {
      if (a[i] == 1)
        rjc++;
      else
        bjc++;
      idxm[rjc - bjc] = i;
    }
    int ans = 2 * n;
    bjc = 0, rjc = 0;
    if (idxm.find(0) != idxm.end()) {
      chmin(ans, 2 * n - idxm[0] - 1);
    }
    for (int i = 2 * n - 1; i >= n; i--) {
      if (a[i] == 1)
        rjc++;
      else
        bjc++;
      if (idxm.find(bjc - rjc) == idxm.end())
        continue;
      else
        chmin(ans, i - idxm[bjc - rjc] - 1);
    }
    cout << ans << '\n';
  }
  return 0;
}
