#include <iostream>
#include <string>
#include <math.h>
#include <ctype.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#define garr(arr,n) for(int i=0;i<n;i++) cin>>arr[i];
#define yn(x) (x?"YES":"NO")
#define r(x) (x>0?x:0)
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
typedef long long ll;
ll MOD = 1000000007;
using namespace std;
void solve()
{
  int n;
  int arr[100001];
  int hash[200002]={0};
  cin>>n;
  garr(arr, n);
  int sum = 0;
  for(int i=0;i<n;i++)
  {
    if(!hash[arr[i]])
    {
      sum++;
      hash[arr[i]] = 1;
    }
    else if(!hash[arr[i] + 1])
    {
      sum++;
      hash[arr[i] + 1] = 1;
    }
  }
  cout<<sum<<endl;
}
int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    solve();
  }
  return 0;
}