#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h> 
using namespace std;
 
#define ll long long int
typedef long double ld;
#define pb push_back
#define mk make_pair
#define fr(i,start,n) for(ll i=start;i<n;i++)
ll MOD = 998244353;
double eps = 1e-12;
#define rfr(i,s,e) for(ll i = s; i >= e; i--)
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define fi first
#define se second
#define INF 2e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
 
void solve();
int main()
{
     fast_cin();
    ll t=1;
    cin >> t;
     while(t--)
   {
         solve();
   }
     return 0;
}
void solve()
{
    ll n;
    cin>>n;
    vector<ll> v(n);
    fr(i,0,n)
    {
        cin>>v[i];
    }
    bool ar[2*n+1];
    memset(ar,false,sizeof(ar));
    fr(i,1,n)
    {
        if(v[i]==v[i-1] || ar[v[i]]==true )
        {
            v[i]++;
            ar[v[i]]=true;
        }
    }
    set<ll> s;
    fr(i,0,n)
    {
        s.insert(v[i]);
    }
    cout<<s.size()<<endl;
}


