#include <bits/stdc++.h>
using namespace std;
int t, n;
int pre[300000];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    int a;
    map<int, int> pos;
    pos[0] = 0;
    for (int i = 1; i <= 2 * n; i++) {
      cin >> a;
      pre[i] = pre[i - 1] + (a == 1 ? 1 : -1);
      if (i <= n) pos[pre[i]] = i;
    }
    int ans = 2 * n;
    for (int i = n; i <= 2 * n; i++) {
      map<int, int>::iterator it = pos.find(pre[i] - pre[n * 2]);
      if (it != pos.end()) ans = min(ans, i - it->second);
    }
    cout << ans << endl;
  }
}
