#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
int a[MAXN];
map<int, int> mp;
int main() {
  int T;
  cin >> T;
  while (T--) {
    mp.clear();
    int n;
    cin >> n;
    for (int i = 1; i <= 2 * n; i++) cin >> a[i];
    int res = 0;
    mp[0] = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] == 1)
        res++;
      else
        res--;
      mp[res] = i;
    }
    int now = 0;
    for (int i = 2 * n; i > n; i--) {
      if (a[i] == 1)
        now++;
      else
        now--;
    }
    if (now + res == 0) {
      cout << "0" << endl;
      continue;
    }
    int ans = 2 * n;
    for (int i = n + 1; i <= 2 * n; i++) {
      if (a[i] == 1)
        now--;
      else
        now++;
      if (mp[-now] != 0) {
        ans = min(i - mp[-now], ans);
      }
    }
    mp.clear();
    res = 0;
    mp[0] = 0;
    for (int i = 2 * n; i > n; i--) {
      if (a[i] == 1)
        res++;
      else
        res--;
      mp[res] = i;
    }
    now = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] == 1)
        now++;
      else
        now--;
    }
    if (now + res == 0) {
      cout << "0" << endl;
      continue;
    }
    for (int i = n; i > 0; i--) {
      if (a[i] == 1)
        now--;
      else
        now++;
      if (mp[-now] != 0) {
        ans = min(mp[-now] - i, ans);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
