#include <bits/stdc++.h>
using namespace std;
int a[200010];
int pre[200010];
map<int, int> num;
int n, N, ans, state;
void solve() {
  for (int i = -N; i <= N; ++i) {
    num[i] = 1000010;
  }
  memset(pre, 0, sizeof pre);
  pre[n] = 0;
  for (int i = n + 1; i <= N; ++i) {
    pre[i] = pre[i - 1] + (a[i] == 1 ? 1 : -1);
    num[pre[i]] = min(num[pre[i]], i);
  }
  int l = n, sum = 0;
  num[0] = n;
  while (l >= 1) {
    sum += (a[l] == 1 ? 1 : -1);
    ans = min(ans, num[-state - sum] - l + 1);
    l--;
  }
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    n;
    cin >> n;
    N = n * 2;
    int x;
    for (int i = 1; i <= N; ++i) {
      cin >> a[i];
    }
    state = 0;
    for (int i = 1; i <= N; ++i) {
      if (a[i] == 1)
        state -= 1;
      else
        state += 1;
    }
    if (state == 0) {
      cout << "0" << endl;
      continue;
    }
    ans = 2000010;
    solve();
    for (int i = 1; i <= N / 2; ++i) {
      swap(a[i], a[N - i + 1]);
    }
    solve();
    cout << ans << endl;
  }
  return 0;
}
