#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <math.h>
#include <assert.h>
using namespace std;
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define point pair < double, double >

int tc,n;
vector < int > A;

int main(){

	
	scanf("%d",&tc);
	while ( tc-- ){
		A.clear();
		scanf("%d",&n);
		for ( int i = 0; i < n; i++ ){
			int z;
			scanf("%d",&z);
			A.pb(z);
		}
		set < int > S;
		for ( int i = n-1; i >= 0; i-- ){
			if ( i < n-1 ){
				if ( A[i] < A[i + 1] - 1 ) A[i]++;
			} else {
				A[i]++;
			}
			S.insert(A[i]);
		}
		printf("%d\n",(int)(S.size()));
	}

	return 0;
}