#include <bits/stdc++.h>
using namespace std;
int t, n, a[100005 << 1], dp[100005 << 1];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (int i = 0; i < n << 1; i++) scanf("%d", &a[i]), dp[i] = -1;
    dp[n << 1] = -1;
    int excess_strawberry_jams = 0;
    for (int i = 0; i < n + 1; i++) {
      dp[excess_strawberry_jams + n] = n - i;
      if (a[2 * n - i - 1] == 1)
        excess_strawberry_jams++;
      else
        excess_strawberry_jams--;
    }
    excess_strawberry_jams = 0;
    long long ans = 2 * n;
    for (int i = 0; i < n + 1; i++) {
      if (dp[n - excess_strawberry_jams] != -1) {
        long long cur_ans = n - i + dp[n - excess_strawberry_jams];
        ans = min(ans, cur_ans);
      }
      if (a[i] == 1)
        excess_strawberry_jams++;
      else
        excess_strawberry_jams--;
    }
    printf("%d\n", ans);
  }
  return 0;
}
