#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 2;
long long a[N], b[N];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    for (long long i = 0; i <= n; ++i) a[i] = b[i] = 0;
    long long ans = 2 * n;
    for (long long i = 1; i <= n; ++i) {
      cin >> a[i];
      a[i] = ((a[i] == 1) ? -1 : 1);
      a[i] += a[i - 1];
    }
    for (long long i = n; i > 0; --i) {
      cin >> b[i];
      b[i] = ((b[i] == 1) ? -1 : 1);
    }
    map<long long, long long> pos;
    pos[0] = 0;
    for (long long i = 1; i <= n; ++i) {
      b[i] += b[i - 1];
      pos[b[i]] = i;
    }
    for (long long i = 0; i <= n; ++i) {
      long long x = a[i];
      if (pos.find(-x) != pos.end()) {
        ans = min(ans, n * 2 - (i + pos[-x]));
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
