#include <bits/stdc++.h>
using namespace std;
int n;
int a[200001];
int biggest[200001];
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (int j = 100000 - n; j <= 100000 + n; j++) biggest[j] = 0;
    for (int i = 1; i <= 2 * n; i++) cin >> a[i];
    int cur = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] == 1)
        cur++;
      else
        cur--;
      biggest[100000 + cur] = i;
    }
    int ans = n + n;
    ans = min(ans, 2 * n - biggest[100000]);
    cur = 0;
    for (int i = 2 * n; i > n; i--) {
      if (a[i] == 1)
        cur++;
      else
        cur--;
      if (biggest[100000 - cur]) {
        ans = min(ans, i - biggest[100000 - cur] - 1);
      }
      if (cur == 0) {
        ans = min(ans, i - 1);
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
