#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
T amax(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
const long long N = 2e5 + 5;
void test_case() {
  long long n;
  cin >> n;
  vector<long long> a(2 * n);
  long long dif = 0;
  for (long long i = 0; i < 2 * n; i++)
    cin >> a[i], dif += a[i] == 2, dif -= a[i] == 1;
  if (dif == 0) {
    cout << 0 << "\n";
    return;
  }
  map<long long, long long> m;
  m[0] = -1;
  long long one = 0, two = 0;
  for (long long i = 0; i < n - 1; i++) {
    one += a[i] == 1, two += a[i] == 2, m[one - two] = i;
  }
  long long ans = (long long)(1e18);
  for (long long i = n - 1; i < 2 * n; i++) {
    one += a[i] == 1, two += a[i] == 2;
    if (m.count(one - two + dif)) amin(ans, i - m[one - two + dif]);
    if (i == n - 1) m[one - two] = i;
  }
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    test_case();
  }
  return 0;
}
