#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int v1[100100];
int v2[100100];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", &v1[i]);
    for (int i = 0; i < n; i++) scanf("%d", &v2[i]);
    map<int, int> mapa;
    int s2, b2;
    s2 = b2 = 0;
    mapa[0] = 0;
    int s, b;
    s = b = 0;
    for (int i = 0; i < n; i++) {
      if (v1[i] == 1)
        s++;
      else
        b++;
      if (v2[i] == 1)
        s++;
      else
        b++;
    }
    int cnt = 1;
    for (int i = 0; i < n; i++) {
      if (v2[i] == 1)
        s2++;
      else
        b2++;
      if (mapa.find(s2 - b2) != mapa.end()) {
        int z = mapa[s2 - b2];
        if (cnt < z) mapa[s2 - b2] = z;
      } else
        mapa[s2 - b2] = cnt;
      cnt++;
    }
    int s1, b1;
    s1 = b1 = 0;
    int l = s - b - s1 + b1;
    int ans = INF;
    if (mapa.find(l) != mapa.end()) ans = mapa[l];
    cnt = 1;
    for (int i = n - 1; i >= 0; i--) {
      if (v1[i] == 1)
        s1++;
      else
        b1++;
      l = s - b - s1 + b1;
      if (mapa.find(l) != mapa.end()) ans = min(ans, cnt + mapa[l]);
      cnt++;
    }
    printf("%d\n", ans);
  }
}
