#include <bits/stdc++.h>
using namespace std;
const int INF = 2e5 + 10;
int n[INF];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    map<int, int> ma;
    memset(n, 0, sizeof(n));
    int N;
    scanf("%d", &N);
    for (int i = 1; i <= N * 2; i++) {
      int k;
      scanf("%d", &k);
      if (k == 2)
        k = 1;
      else
        k = -1;
      n[i] = n[i - 1] + k;
    }
    int ans = 2 * N;
    ma[0] = 2 * N + 1;
    for (int i = 2 * N; i > N; i--) ma[n[2 * N] - n[i - 1]] = i;
    for (int i = N; i >= 0; i--) {
      map<int, int>::iterator it;
      it = ma.find(-n[i]);
      if (it != ma.end()) ans = min(ans, it->second - i - 1);
    }
    cout << ans << endl;
  }
  return 0;
}
