#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 20;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long CT;
  cin >> CT;
  while (CT--) {
    long long n, l[maxn], r[maxn], dif = 0, cur = 0;
    cin >> n;
    for (long long i = 0; i < (n); ++i) {
      cin >> l[i];
      if (l[i] == 1)
        dif++;
      else
        dif--;
    }
    for (long long i = 0; i < (n); ++i) {
      cin >> r[i];
      if (r[i] == 1)
        dif++;
      else
        dif--;
    }
    map<long long, long long> m;
    m[0] = 0;
    cur = 0;
    for (long long i = 0; i < (n); ++i) {
      if (r[i] == 1)
        cur++;
      else
        cur--;
      if (!m.count(cur)) {
        m[cur] = i + 1;
      }
    }
    long long ans = 999999999;
    cur = 0;
    for (long long i = n - 1; i >= (0); --i) {
      if (m.count(dif - cur)) ans = min(ans, n - i - 1 + m[dif - cur]);
      if (l[i] == 1)
        cur++;
      else
        cur--;
    }
    if (m.count(dif - cur)) ans = min(ans, n + m[dif - cur]);
    cout << ans << "\n";
  }
}
