#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first < b.first);
}
int min(int a, int b) {
  if (a >= b) {
    return b;
  } else {
    return a;
  }
}
int main() {
  int t;
  cin >> t;
  for (int r = 1; r <= t; r++) {
    int n;
    cin >> n;
    int strl[n + 1];
    int cntl[n + 1];
    int strr[n + 1];
    int cntr[n + 1];
    int difl[n + 1];
    int difr[n + 1];
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
      cin >> strl[i];
      if (strl[i] == 1) {
        cnt++;
      }
      cntl[i] = cnt;
    }
    cnt = 0;
    for (int i = 1; i <= n; i++) {
      cin >> strr[n - i + 1];
      cntr[n - i + 1] = -1 * cnt;
      if (strr[n - i + 1] == 1) {
        cnt++;
      }
    }
    for (int i = 1; i <= n; i++) {
      cntr[n - i + 1] += cnt;
    }
    cntl[0] = 0;
    cntr[0] = 0;
    for (int i = 0; i <= n; i++) {
      difl[i] = 2 * cntl[i] - i;
      difr[i] = 2 * cntr[i] - i;
    }
    vector<pair<int, int>> pl;
    vector<pair<int, int>> pr;
    for (int i = 0; i <= n; i++) {
      pr.push_back(make_pair(difr[i], i));
    }
    sort(pr.begin(), pr.end());
    int min = 2 * n + 5;
    int minn = 0;
    int arr1[n + 1];
    int arr2[n + 2];
    for (int i = 0; i <= n; i++) {
      arr1[i] = pr[i].first;
      arr2[i] = pr[i].second;
    }
    for (int i = n; i >= 0; i--) {
      auto ptr = lower_bound(arr1, arr1 + n + 1, -difl[i]);
      auto ptr1 = upper_bound(arr1, arr1 + n + 1, -difl[i]);
      if (arr1[ptr - arr1] == -difl[i]) {
        while (ptr < ptr1) {
          if (arr2[ptr - arr1] > minn) {
            minn = arr2[ptr - arr1];
          }
          ptr++;
        }
        if (n - i + n - minn < min) {
          min = n - i + n - minn;
        }
      }
    }
    cout << min << endl;
  }
}
