C++#include<bits/stdc++.h>
#define int long long
using namespace std;
int solve() {
int n;
cin >> n;
vector<int> a(n);
map<int, int> freq;
for (int i = 0; i < n; ++i) {
cin >> a[i];
freq[a[i]]++;
}
sort(a.begin(), a.end());
int res = 0;
for (auto it = freq.begin(); it != freq.end(); ++it) {
int x = it->first;
int cnt = it->second;
if (freq.find(x - 1) == freq.end()) {
res += cnt;
} else {
if (cnt > freq[x - 1]) {
res += cnt - freq[x - 1];
}
}
}
return res;
}
signed main() {
int T;
cin >> T;
while (T--) {
cout << solve() << '\n';
}
return 0;
}