#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int inf = 0x3f3f3f3f;
int s[N << 1];
int a[N];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    map<int, int> mp;
    s[0] = 0;
    for (int i = 1; i <= n * 2; i++) {
      scanf("%d", &a[i]);
      if (i <= n) {
        s[i] = s[i - 1] + (a[i] == 1 ? 1 : -1);
        mp[s[i]] = i;
      }
    }
    int ans = inf;
    s[2 * n + 1] = 0;
    for (int i = 2 * n; i > n; i--) {
      s[i] = s[i + 1] + (a[i] == 1 ? 1 : -1);
      if (mp.find(-s[i]) != mp.end()) {
        ans = min(ans, i - mp[-s[i]] - 1);
      }
      if (s[i] == 0) {
        ans = min(ans, i - 1);
      }
      if (s[i - n] == 0) {
        ans = min(ans, 3 * n - i);
      }
    }
    if (ans != inf)
      printf("%d\n", ans);
    else
      printf("%d\n", 2 * n);
  }
}
