#include <bits/stdc++.h>
#define hotel trivago
#define ll long long 
using namespace std;


int main() {
    int t; cin >> t;

	while (t--) {
		int n, mx=0, mn=pow(10,5), ans=0; 
		cin >> n;
		map<int, int> b;
        set<int> c;

		for (int i=0;i<n;i++){
			int k; cin >> k;
            if (k>mx) mx=k;
			if (k<mn) mn=k;
			b[k]++;
			c.insert(k);
		}
        
		ans = c.size();

		for (int i=mn;i<=mx;i++) {
			if (b[i]>1 && b[i+1]==1) {
				b[i+1]++;
			}
			else if (b[i]>1 && b[i+1]==0) {
				ans++; b[i+1]++;
			}
		}

		cout << ans << endl;
	}

	return 0;
}