#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b)
    return a;
  else
    return b;
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(2 * n);
  for (int i = 0; i < 2 * n; i++) {
    cin >> a[i];
  }
  int din = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (a[i] == 1)
      din += 1;
    else
      din -= 1;
  }
  if (din == 0) {
    cout << 0 << endl;
    return;
  }
  map<int, int> m;
  int dr = 0;
  m[0] = n - 1;
  for (int i = n; i < 2 * n; i++) {
    if (a[i] == 1)
      dr += 1;
    else
      dr -= 1;
    if (!m.count(dr)) {
      m[dr] = i;
    }
  }
  int ans = 1e9 + 7;
  int dl = 0;
  if (m.count(din)) {
    ans = min(ans, m[din] - n + 1);
  }
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] == 1)
      dl += 1;
    else
      dl -= 1;
    int q = din - dl;
    if (m.count(q)) {
      ans = min(ans, m[q] - i + 1);
    }
  }
  cout << ans << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
