#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 200005;
void solve() {
  long long n;
  cin >> n;
  vector<long long> v(2 * n);
  long long a = 0, b = 0, la = 0, lb = 0, ra = 0, rb = 0;
  vector<long long> right, left;
  for (long long i = 0; i < 2 * n; i++) {
    cin >> v[i];
    if (v[i] == 1)
      a++;
    else
      b++;
  }
  long long dinit = a - b;
  if (dinit == 0) {
    cout << 0 << "\n";
    return;
  }
  vector<long long> dleft(n), dright(n);
  map<long long, long long> mp;
  for (long long i = n; i < 2 * n; i++) right.push_back(v[i]);
  for (long long i = n - 1; i >= 0; i--) left.push_back(v[i]);
  for (long long i = 0; i < n; i++) {
    if (left[i] == 1)
      la++;
    else
      lb++;
    dleft[i] = la - lb;
    if (right[i] == 1)
      ra++;
    else
      rb++;
    dright[i] = ra - rb;
    if (mp.find(dright[i]) == mp.end()) mp[dright[i]] = i;
  }
  mp[0] = -1;
  long long ans = INT_MAX;
  if (mp.find(dinit) != mp.end()) ans = mp[dinit] + 1;
  for (long long i = 0; i < n; i++) {
    long long d = dinit - dleft[i];
    if (mp.find(d) != mp.end()) ans = min(ans, mp[d] + 1 + i + 1);
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
