#include <bits/stdc++.h>
using namespace std;
long long t, n, cnt1, cnt2, ans;
long long a[200005], b[200005];
map<long long, long long> mp[3];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    cnt1 = cnt2 = 0;
    for (long long i = 1; i <= 2 * n; i++) {
      cin >> a[i];
      b[i] = 0;
      a[i] == 1 ? cnt1++ : cnt2++;
    }
    if (cnt1 == cnt2) {
      cout << 0 << "\n\n";
      continue;
    }
    long long mk1, mk2;
    mk1 = mk2 = 0;
    if (cnt1 > cnt2) {
      mk1 = 1;
      mk2 = -1;
    } else {
      mk1 = -1;
      mk2 = 1;
    }
    a[n] == 1 ? b[n] = mk1 : b[n] = mk2;
    for (long long i = n - 1; i >= 1; i--) {
      b[i] = b[i + 1];
      a[i] == 1 ? b[i] += mk1 : b[i] += mk2;
    }
    a[n + 1] == 1 ? b[n + 1] = mk1 : b[n + 1] = mk2;
    for (long long i = n + 2; i <= 2 * n; i++) {
      b[i] = b[i - 1];
      a[i] == 1 ? b[i] += mk1 : b[i] += mk2;
    }
    mp[1].clear();
    mp[2].clear();
    for (long long i = n; i >= 1; i--) {
      if (b[i] > 0) {
        if (mp[1][b[i]] == 0) mp[1][b[i]] = i;
      }
    }
    for (long long i = n + 1; i <= 2 * n; i++) {
      if (b[i] > 0) {
        if (mp[2][b[i]] == 0) mp[2][b[i]] = i;
      }
    }
    ans = 1e18;
    long long mk = abs(cnt1 - cnt2);
    long long tmpans;
    for (long long i = mk; i >= 0; i--) {
      tmpans = 1e18;
      if (mp[1][i] != 0) {
        if (mk - i == 0) {
          tmpans = n - mp[1][i] + 1;
        } else if (mp[2][mk - i] != 0) {
          tmpans = n - mp[1][i] + 1 + mp[2][mk - i] - n;
        }
      } else if (i == 0) {
        if (mp[2][mk] != 0) {
          tmpans = mp[2][mk] - n;
        }
      }
      ans = min(ans, tmpans);
    }
    cout << ans << "\n\n";
  }
  return 0;
}
