#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9;
int t, n;
int a[2 * 100012], num1[2 * 100012], num2[2 * 100012], dis[2 * 100012];
void kaisa() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= 2 * n; i++) {
      cin >> a[i];
    }
    map<int, int> m;
    for (int i = 1; i <= n; i++) {
      num1[i] = num1[i - 1];
      num2[i] = num2[i - 1];
      if (a[i] == 1) num1[i]++;
      if (a[i] == 2) num2[i]++;
      dis[i] = num1[i] - num2[i];
    }
    for (int i = 2 * n; i >= n + 1; i--) {
      num1[i] = num1[i + 1];
      num2[i] = num2[i + 1];
      if (a[i] == 1) num1[i]++;
      if (a[i] == 2) num2[i]++;
      dis[i] = num2[i] - num1[i];
      if (m[dis[i]] == 0)
        m[dis[i]] = i;
      else
        m[dis[i]] = min(m[dis[i]], i);
    }
    int res = 2 * n;
    for (int i = 1; i <= n; i++) {
      int temp = dis[i];
      int t = m[temp];
      if (t == 0) continue;
      res = min(res, t - i - 1);
    }
    for (int i = 1; i <= n; i++) {
      if (dis[i] == 0) {
        res = min(res, 2 * n - i);
      }
    }
    for (int i = n + 1; i <= 2 * n; i++) {
      if (dis[i] == 0) {
        res = min(res, i - 1);
      }
    }
    cout << res << "\n";
    for (int i = 1; i <= 2 * n; i++) {
      num1[i] = 0;
      num2[i] = 0;
      dis[i] = 0;
    }
  }
}
int main() {
  kaisa();
  return 0;
}
