#pragma  GCC optimize ("O3")
#pragma  GCC optimize("unroll-loops")
#pragma  GCC target("sse4")
#include "iostream"
#include "cassert"
#include "cmath"
#include "cstdio"
#include "cstdlib"
#include "map"
#include "set"
#include "queue"
#include "vector"
#include "algorithm"
#include "numeric"
#include "unordered_map"
#include "cstring"
#include <stack>
#define mod 1000000007
using namespace std;
#define LL long long int
using namespace std;
int main() 
{
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    LL T;
    cin >> T;
    while(T--)
    {
        LL N;
        cin >> N;
        vector<LL> arr(N);
        for(auto &it:arr)
        {
            cin >> it;
        }
        map<LL,LL> hash;
        for(auto it:arr)
        {
            hash[it]++;
        }
        set<LL> S;
        for(auto it:hash)
        {
            S.insert(it.first);
            if(it.second>1)
            {
                hash[it.first+1]++;
            }
        }
        cout<<S.size()<<endl;
    }
}