#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
#define forr(i,n) for(int i = 0 ; i  < n ; i++)
#define forr1(i,n) for(int i = 1 ; i  <= n ; i++)
#define pb push_back
#define endl "\n"

const int mod  = 998244353;

string s , a, b ;

int main()
{

#ifndef ONLINE_JUDGE
  freopen("input.txt" , "r" , stdin);
  freopen("output.txt" , "w" , stdout);
#endif
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);


  int t;
  cin >> t;

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

    map<int , int> m ;
    int x ;
    for (int i = 1 ; i <= 2 * n ; i++)
      m[i] = 0;
    forr(i, n)
    {
      cin >> x;
      m[x] = 1;
    }
    vector<int> ans(n + 1);
    ans[0]++;
    ans[n]++;
    int l = 1 , r = n - 1 ;
    int j = 1;

    for (int i = 1 ; i <= 2 * n ; i++)
    {
      if (m[i] == 1)
      {
        // cout << j << " " << i << endl;

        j = max(i , j);
        // cout << j << " " << i << endl;
        while (j < 2 * n  && m[j] != 0 )
          j++;
        if (m[j] == 0)
          m[j] = 2 ;
        else break;
        ans[l++]++;
      }
    }

    for (int i = 1 ; i <= 2 * n ; i++)
    {
      if (m[i] == 2) m[i] = 0;
    }
    j = 2 * n - 1;
    for (int i = 2 * n ; i >= 1; i--)
    {
      if (m[i] == 1)
      {
        j = min(i, j);
        while ( j != 1 && m[j] != 0 )
          j--;
        if (m[j] == 0)
          m[j] = 2;
        else break;
        ans[r--]++;
        // cout << i << " " << j << endl;


      }
    }
    int res = 0 ;
    for (int i = 0 ; i <= n ; i++)
    {
      // cout << ans[i] << " " << i << endl;
      if (ans[i] == 2) res++;
    }
    cout << res << "\n";

  }
  return 0 ;
}