#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int MAXN=100005;
int a[MAXN];
int main(){
	int T; scanf("%d",&T);
	while(T--){
		int n; scanf("%d",&n);
		for(int i=1;i<=n;i++)
			scanf("%d",&a[i]);
		a[n+1]=2147483647;
		int ans=0;
		for(int i=n;i>=1;i--){
			if(a[i]!=a[i+1]) ans++;
			if(a[i]+1<a[i+1]) a[i]++;
		}
		printf("%d\n",ans);
	}
	return 0;
}
		 	    		  	 	 	  		   			  		