#include <bits/stdc++.h>
using namespace std;
long long int mod_expo(long long int x, long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    map<long long int, long long int> right;
    long long int n;
    cin >> n;
    long long int ar[2 * n + 4];
    long long int dp[2 * n + 3];
    for (long long int i = 0; i < 2 * n; i++) {
      cin >> ar[i];
    }
    long long int count = 0;
    for (long long int i = 0; i < n; i++) {
      if (ar[i] == 1)
        count++;
      else {
        count--;
      }
      dp[i] = count;
    }
    count = 0;
    for (long long int i = 2 * n - 1; i >= n; i--) {
      if (ar[i] == 1)
        count--;
      else {
        count++;
      }
      dp[i] = count;
      right[count] = i;
    }
    long long int mini = 2 * n;
    for (long long int i = 0; i < 2 * n; i++) {
      if (dp[i] == 0) {
        if (i < n && mini > (2 * n - i - 1))
          mini = 2 * n - i - 1;
        else if (i >= n && mini > (i))
          mini = i;
      }
    }
    for (long long int i = n - 1; i >= 0; i--) {
      long long int p = dp[i];
      long long int k = right[p];
      if (k > 0 && mini > (k - i - 1)) mini = k - i - 1;
    }
    cout << mini << endl;
  }
  return 0;
}
