#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll  long long
#define fp cout<<fixed<<setprecision(9);
#define loop(var,s,n) for(ll var=s ;var<n;var++)
#define rloop(var,s,n) for(ll var=s ;var>=n;var--)
#define pb push_back
#define endl '\n'
#define mk make_pair
#define all(x) x.begin(),x.end()
#define mod 1000000007
using namespace std;

int main() {
#ifdef KEVIN
	freopen("ingoing3.txt", "r", stdin);
	freopen("outgoing3.txt", "w", stdout);
#endif
	FAST
	int t = 1;
	cin >> t;
	while (t--)
	{
		int n;
		cin >> n;
		vector<ll>v(n);
		map<ll, ll>mp;
		set<ll>ans;
		loop(i, 0, n)
		{
			cin >> v[i];
			mp[v[i]]++;
		}
		sort(all(v));
		rloop(i, n - 1, 0)
		{

			if (mp[v[i] + 1] == 0)
			{
				mp[v[i] + 1]++;
				mp[v[i]]--;
				v[i]++;
			}
			//cout << v[i] << " ";
			ans.insert(v[i]);
		}
		cout << ans.size() << endl;







	}
}

