#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 5;
int sum[2 * N];
int main() {
  int t;
  scanf("%d", &t);
  int n;
  while (t--) {
    map<int, int> pos;
    scanf("%d", &n);
    int d;
    pos[0] = 0;
    for (int i = 1; i <= 2 * n; ++i) {
      scanf("%d", &d);
      if (d == 2) {
        d = -1;
      } else {
        d = 1;
      }
      sum[i] = sum[i - 1] + d;
      if (i <= n) pos[sum[i]] = i;
    }
    int ans = n * 2;
    for (int i = n; i <= n * 2; ++i) {
      int q = sum[i] - sum[n * 2];
      auto it = pos.find(q);
      if (it != pos.end()) ans = min(ans, i - it->second);
    }
    cout << ans << endl;
  }
  return 0;
}
