import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto a = readln.splitter.map !(to !(int)).array;
		bool [int] b;
		b[a[0]] = true;
		foreach (i; 1..n)
		{
			if (a[i] <= a[i - 1])
			{
				a[i] += 1;
			}
			b[a[i]] = true;
		}
		writeln (b.length);
	}
}
