#include <bits/stdc++.h>
using namespace std;
vector<int> l;
int b, s;
map<int, int> mp;
int main() {
  std::ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    mp.clear();
    b = s = 0;
    l.clear();
    int n;
    cin >> n;
    int a[2 * (n + 1)];
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      if (a[i] == 1) {
        s++;
      } else {
        b++;
      }
    }
    l.push_back(s - b);
    for (int i = n; i > 0; i--) {
      if (a[i] == 1) {
        s--;
      } else {
        b--;
      }
      l.push_back(s - b);
    }
    for (int i = n + 1; i <= 2 * n; i++) {
      cin >> a[i];
      if (a[i] == 1) {
        s++;
      } else {
        b++;
      }
    }
    if (s - b == 0 && l[0] == 0) {
      cout << 0 << endl;
      continue;
    }
    mp[s - b] = 1;
    for (int i = n + 1; i <= 2 * n; i++) {
      if (a[i] == 1) {
        s--;
      } else {
        b--;
      }
      if (mp[s - b] == 0) {
        mp[s - b] = i - n + 1;
      }
    }
    int ans = 1e9;
    for (int i = 0; i <= n; i++) {
      if (mp[-1 * l[i]] != 0) {
        ans = min(ans, i + mp[(-1 * l[i])] - 1);
      }
    }
    cout << ans << endl;
  }
}
