#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long int INF = 9e18 + 2e17;
const int inf = 2e9;
const int N = 1e3 + 22;
const double eps = 1e-10;
const double PI = 3.14159265;
void solve() {
  int n;
  cin >> n;
  int a[2 * n + 1];
  int one = 0, two = 0;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> a[i];
    if (a[i] == 1)
      one++;
    else
      two++;
  }
  int diff = abs(one - two);
  if (diff == 0) {
    cout << 0 << '\n';
    return;
  }
  int mor = (one > two) ? 1 : 2;
  vector<int> left(2 * n + 1, 1e9), right(2 * n + 1, 1e9);
  left[0] = 0, right[0] = 0;
  int cur = 0;
  for (int i = n + 1; i <= 2 * n; i++) {
    if (a[i] == mor)
      cur++;
    else
      cur--;
    if (cur > 0) right[cur] = min(right[cur], i - n);
  }
  cur = 0;
  for (int i = n; i >= 1; i--) {
    if (a[i] == mor)
      cur++;
    else
      cur--;
    if (cur > 0) left[cur] = min(left[cur], n - i + 1);
  }
  int ans = 1e9;
  for (int i = 0; i <= diff; i++) {
    ans = min(ans, right[i] + left[diff - i]);
  }
  cout << ans << endl;
  return;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
