#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)2e9;
const long long mod = 1000000007;
long long dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
long long powmod(long long a, long long p) {
  long long ans = 1;
  a %= mod;
  while (p) {
    if (p & 1) ans *= a;
    p /= 2;
    a *= a;
    ans %= mod;
    a %= mod;
  }
  return ans;
}
long long mdinv(long long a) { return powmod(a, mod - 2); }
const long long N = 1e5 + 2;
long long v1[N];
long long v2[N];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tt;
  cin >> tt;
  map<long long, long long> mp;
  while (tt--) {
    long long n;
    cin >> n;
    mp.clear();
    long long a = 0, b = 0;
    for (long long i = 0; i < (long long)n; i++) {
      cin >> v1[i];
      if (v1[i] == 1) {
        a++;
        v1[i] = -1;
      } else {
        b++;
        v1[i] = 1;
      }
    }
    v1[n] = 0;
    v2[0] = 0;
    for (long long i = 1; i <= n; i++) {
      cin >> v2[i];
      if (v2[i] == 1) {
        a++;
        v2[i] = -1;
      } else {
        b++;
        v2[i] = 1;
      }
    }
    mp[v2[0]] = 0;
    for (long long i = 1; i <= n; i++) {
      v2[i] += v2[i - 1];
      if (!mp.count(v2[i])) mp[v2[i]] = i;
    }
    long long diff = a - b;
    long long ans = INT_MAX;
    for (long long i = n; i >= 0; i--) {
      if (i + 1 <= n) v1[i] += v1[i + 1];
      long long here = diff + v1[i];
      long long req = -here;
      if (mp.count(req)) {
        ans = min(ans, n - i + mp[req]);
      }
    }
    cout << ans << "\n";
  }
}
