#include <bits/stdc++.h>
using namespace std;
const long long int N = 500010;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int ar[n];
    for (long long int i = 0; i < n; ++i) {
      cin >> ar[i];
    }
    long long int br[n];
    for (long long int i = 0; i < n; ++i) {
      cin >> br[i];
    }
    map<long long int, long long int> m;
    long long int a1 = 0, a2 = 0;
    m[0] = -1;
    for (long long int i = 0; i < n; ++i) {
      if (ar[i] == 1) {
        ++a1;
      } else {
        ++a2;
      }
      m[a2 - a1] = i;
    }
    long long int ans = 2 * n;
    a1 = 0;
    a2 = 0;
    ans = min(ans, n - 1 - m[0] + n);
    for (long long int i = n - 1; i >= 0; --i) {
      if (br[i] == 1) {
        ++a1;
      } else {
        ++a2;
      }
      long long int ch = a1 - a2;
      if (m.find(ch) != m.end()) {
        long long int idx = m[ch];
        ans = min(ans, n - idx - 1 + i);
      }
    }
    cout << ans << endl;
  }
  return (0);
}
