#include <bits/stdc++.h>
using namespace std;
long long powmod(long long a, long long b, long long mod) {
  if (b == 0 || a == 1) return mod == 1 ? 0 : 1;
  if (b % 2 == 0) {
    long long k = powmod(a, b / 2, mod);
    return (k * k) % mod;
  } else {
    long long k = powmod(a, b / 2, mod);
    return ((k * k) % mod * a) % mod;
  }
}
int gcd(int a, int b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
bool is_prime(int n) {
  int bound = sqrt(n);
  int d = 2;
  while (d <= bound && n % d != 0) ++d;
  return d * d > n;
}
void sort(vector<long long> &a) { sort(a.begin(), a.end()); }
void sort(vector<int> &a) { sort(a.begin(), a.end()); }
void sort(vector<pair<long long, long long>> &a) { sort(a.begin(), a.end()); }
void sort(vector<pair<int, int>> &a) { sort(a.begin(), a.end()); }
void rev(vector<long long> &a) { reverse(a.begin(), a.end()); }
void rev(vector<int> &a) { reverse(a.begin(), a.end()); }
void rev(vector<pair<long long, long long>> &a) { reverse(a.begin(), a.end()); }
void rev(vector<pair<int, int>> &a) { reverse(a.begin(), a.end()); }
void rev(string &a) { reverse(a.begin(), a.end()); }
const int MOD = 1000000007;
const int INF = 1000000050;
const int MAXN = 300010;
const double EPS = 1e-9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int j = 0; j < n; j++) cin >> a[j];
    sort(a);
    int ans = 1;
    for (int j = 1; j < n; j++) {
      if (a[j] - a[j - 1] == 1) ++ans;
    }
    cout << min(ans, 2) << '\n';
  }
}
