#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 9;
const int INF = 1000000000 + 9;
int n, t;
int a[MAXN], b[MAXN];
int fa[MAXN], ga[MAXN], fb[MAXN], gb[MAXN], delta[2 * MAXN];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = n; i >= 1; i--) cin >> b[i];
    for (int i = 1; i <= n; ++i) {
      fa[i] = fa[i - 1];
      ga[i] = ga[i - 1];
      fb[i] = fb[i - 1];
      gb[i] = gb[i - 1];
      if (a[i] == 1)
        fa[i] = fa[i] + 1;
      else
        ga[i] = ga[i] + 1;
      if (b[i] == 1)
        fb[i] = fb[i] + 1;
      else
        gb[i] = gb[i] + 1;
    }
    for (int i = 0; i <= 2 * n; ++i) delta[i] = INF;
    delta[0 + n] = 0;
    for (int i = 1; i <= n; ++i) {
      delta[n + fb[i] - gb[i]] = i;
    }
    int ans = 2 * n;
    for (int i = 0; i <= n; ++i) {
      int x = n - i;
      int temp = fa[i] - ga[i];
      if (delta[-temp + n] != INF) {
        int y = n - delta[-temp + n];
        ans = min(ans, x + y);
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
