#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long left[n + 1], right[n + 1];
    for (long long i = n; i >= 1; i--) cin >> left[i];
    for (long long i = 1; i <= n; i++) cin >> right[i];
    map<long long, long long> mp;
    long long cnt = 0;
    for (long long i = n; i >= 1; i--) {
      if (left[i] == 1)
        cnt++;
      else
        cnt--;
      mp[cnt] = i - 1;
    }
    cnt = 0;
    long long ans = INT_MAX;
    for (long long i = 1; i <= n; i++) {
      if (right[i] == 1)
        cnt++;
      else
        cnt--;
    }
    if (mp.find(-cnt) != mp.end()) {
      ans = min(ans, mp[-cnt]);
    }
    for (long long i = 1; i <= n; i++) {
      if (right[i] == 1)
        cnt--;
      else
        cnt++;
      if (mp.find(-cnt) != mp.end()) ans = min(ans, i + mp[-cnt]);
    }
    cnt = 0;
    mp.clear();
    for (long long i = n; i >= 1; i--) {
      if (right[i] == 1)
        cnt++;
      else
        cnt--;
      mp[cnt] = i - 1;
    }
    cnt = 0;
    for (long long i = 1; i <= n; i++) {
      if (left[i] == 1)
        cnt++;
      else
        cnt--;
    }
    if (mp.find(-cnt) != mp.end()) {
      ans = min(ans, mp[-cnt]);
    }
    for (long long i = 1; i <= n; i++) {
      if (left[i] == 1)
        cnt--;
      else
        cnt++;
      if (mp.find(-cnt) != mp.end()) ans = min(ans, i + mp[-cnt]);
    }
    if (ans == INT_MAX) ans = 2 * n;
    cout << ans << endl;
  }
  return 0;
}
