#include <bits/stdc++.h>
using namespace std;
long long fp(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res *= a;
    a *= a;
    b /= 2;
  }
  return res;
}
long long m, n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, red = 0, blue = 0;
    cin >> n;
    vector<long long> a(n), b(n);
    for (long long i = n - 1; i >= 0; i--) {
      cin >> a[i];
      if (a[i] == 1)
        ++red;
      else
        ++blue;
    }
    for (long long i = 0; i < n; i++) {
      cin >> b[i];
      if (b[i] == 1)
        ++red;
      else
        ++blue;
    }
    if (red == blue) {
      cout << "0\n";
      continue;
    }
    long long diff = red - blue, curr = 0;
    map<long long, long long> ma, mb;
    for (long long i = 0; i < n; i++) {
      curr += (a[i] == 1) ? 1 : -1;
      if (!ma[curr]) ma[curr] = i + 1;
    }
    curr = 0;
    for (long long i = 0; i < n; i++) {
      curr += (b[i] == 1) ? 1 : -1;
      if (!mb[curr]) mb[curr] = i + 1;
    }
    long long ans = 1e9;
    if (ma.find(diff) != ma.end()) ans = ma[diff];
    if (mb.find(diff) != mb.end()) ans = min(ans, mb[diff]);
    for (auto i : ma) {
      if (mb[diff - i.first]) {
        ans = min(ans, i.second + mb[diff - i.first]);
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
