#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    int data[200005];
    int o, t;
    o = t = 0;
    int need;
    for (int i = 0; i <= 2 * n; ++i) {
      if (i == n) {
        data[i] = 0;
        continue;
      }
      cin >> data[i];
      if (data[i] == 1) o++;
      if (data[i] == 2) t++;
    }
    if (o == t) {
      cout << 0 << "\n";
      continue;
    } else if (o < t) {
      need = 2;
    } else {
      need = 1;
    }
    int l = n;
    int r = n;
    int right[200005] = {0};
    int left[200005] = {0};
    int total = abs(t - o);
    for (int i = 1; i <= n; ++i) {
      if (data[n + i] == need) {
        right[i] = right[i - 1] + 1;
      } else {
        right[i] = right[i - 1] - 1;
      }
      if (data[n - i] == need) {
        left[i] = left[i - 1] + 1;
      } else {
        left[i] = left[i - 1] - 1;
      }
    }
    int dpLeft[200005];
    int dpRight[200005];
    for (int i = 0; i <= total; ++i) {
      dpLeft[i] = 9999999;
      ;
    }
    for (int i = 0; i <= total; ++i) {
      dpRight[i] = 9999999;
      ;
    }
    for (int i = 1; i <= n; ++i) {
      dpLeft[left[i]] = min(dpLeft[left[i]], i);
    }
    for (int i = 1; i <= n; ++i) {
      dpRight[right[i]] = min(dpRight[right[i]], i);
    }
    dpLeft[0] = 0;
    dpRight[0] = 0;
    int ans = 9999999;
    ;
    for (int i = 0; i <= total; ++i) {
      ans = min(ans, dpLeft[total - i] + dpRight[i]);
    }
    cout << ans << "\n";
  }
  return 0;
}
