#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif

    int t, n, x;
    cin >> t;

    while (t--) {
        cin >> n;

        vector<int> pre(2 * n + 1, false);
        for (int i = 1; i <= n; i++) {
            cin >> x;
            pre[x] = true;
        }

        vector<int> select;
        vector<int> non_select;
        for (int i = 1; i <= 2 * n; i++) {
            if (pre[i])
                select.emplace_back(i);
            else {
                non_select.emplace_back(i);
            }
        }

        vector<pair<int, int>> sign(n, {0, 0});
        for (int i = 0; i < n; i++) {
            int l = 0, r = n - 1;

            while (l <= r) {
                int mid = (l + r) / 2;
                if (non_select[mid] < select[i])
                    l = mid + 1;
                else
                    r = mid - 1;
            }

            sign[i].first = l;
            sign[i].second = n - l;
        }

        for (int i = 1; i < n; i++)
            if (sign[i].second >= sign[i - 1].second)
                sign[i].second = max(0, sign[i - 1].second - 1);
        for (int i = n - 2; i >= 0; i--)
            if (sign[i].first >= sign[i + 1].first)
                sign[i].first = max(0, sign[i + 1].first - 1);
        int start = 0;
        for (int i = 0; i < n; i++)
            if (sign[i].first == 0)
                start = i + 1;

        int end = n;
        for (int i = n - 1; i >= 0; i--)
            if (sign[i].second == 0)
                end = i;

        cout << (end - start + 1) << "\n";
    }
}
