#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, x;
    cin >> n;
    map<long long int, long long int> mp;
    long long int a[2 * n + 4];
    a[0] = 0;
    mp[0] = 0;
    for (long long int i = 1; i <= n * 2; i++) {
      cin >> x;
      if (x == 2) x = -1;
      a[i] = a[i - 1] + x;
      if (i <= n) mp[a[i]] = i;
    }
    long long int ans = n * 2;
    for (long long int i = n; i <= n * 2; i++) {
      auto it = mp.find(a[i] - a[n * 2]);
      if (it != mp.end()) ans = min(ans, i - it->second);
    }
    cout << ans << endl;
  }
  return 0;
}
