#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int blue = 0;
    int straw = 0;
    vector<int> prefixes(n + 1);
    vector<int> second(n);
    unordered_map<int, int> suffixes;
    for (int i = 0; i < n; i++) {
      int temp;
      cin >> temp;
      if (temp == 1)
        straw += 1;
      else
        blue += 1;
      prefixes[i + 1] = blue - straw;
    }
    for (int i = 0; i < n; i++) {
      cin >> second[i];
    }
    reverse(second.begin(), second.end());
    blue = 0;
    straw = 0;
    for (int i = 0; i < n; i++) {
      if (second[i] == 1)
        straw += 1;
      else
        blue += 1;
      suffixes[straw - blue] = i + 1;
    }
    int mx = 0;
    for (int i = 0; i <= n; i++) {
      int left = 0;
      if (suffixes[prefixes[i]] || prefixes[i] == 0) {
        left = i + suffixes[prefixes[i]];
      }
      if (left > mx) {
        mx = left;
      }
    }
    cout << 2 * n - mx << "\n";
  }
  return 0;
}
