#include <bits/stdc++.h>
using namespace std;
bool b[200005];
int a[200005];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i <= 2 * n; i++) a[i] = -1;
    for (int i = 0; i < 2 * n; i++) {
      int c;
      cin >> c;
      b[i] = c - 1;
    }
    int now = 0;
    a[n] = 0;
    for (int i = 0; i < n; i++) {
      if (b[i])
        now++;
      else
        now--;
      a[now + n] = i + 1;
    }
    now = 0;
    int ans = a[n];
    for (int i = 2 * n - 1; i >= n; i--) {
      if (b[i])
        now--;
      else
        now++;
      if (a[n + now] >= 0) ans = max(ans, 2 * n - i + a[now + n]);
    }
    cout << 2 * n - ans << '\n';
  }
}
