#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long n, t, a[100005], b[100005], da[100005], db[100005];
map<int, int> mp;
long long solve(int idx) {
  int res = idx;
  int d = db[idx + 1];
  if (!mp.count(d)) return 2 * n;
  res += n - mp[d];
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      if (a[i] == 1)
        da[i] = 1 + da[i - 1];
      else
        da[i] = -1 + da[i - 1];
      mp[da[i]] = i;
    }
    if (!mp.count(0)) mp[0] = 0;
    for (int i = 1; i <= n; i++) cin >> b[i];
    for (int i = n; i >= 1; i--) {
      if (b[i] == 1)
        db[i] = -1 + db[i + 1];
      else
        db[i] = 1 + db[i + 1];
    }
    long long ans = 1e9;
    for (int i = 0; i <= n; i++) ans = min(ans, solve(i));
    cout << ans << endl;
    mp.clear();
    for (int i = 0; i <= n + 2; i++) da[i] = db[i] = a[i] = b[i] = 0;
  }
  return 0;
}
