You are a coach of a group consisting of $n$ students. The $i$-th student has programming skill $a_i$. All students have distinct programming skills. You want to divide them into teams in such a way that:  No two students $i$ and $j$ such that $|a_i - a_j| = 1$ belong to the same team (i.e. skills of each pair of students in the same team have the difference strictly greater than $1$);  the number of teams is the minimum possible. 

You have to answer $q$ independent queries.


-----Input-----

The first line of the input contains one integer $q$ ($1 \le q \le 100$) — the number of queries. Then $q$ queries follow.

The first line of the query contains one integer $n$ ($1 \le n \le 100$) — the number of students in the query. The second line of the query contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 100$, all $a_i$ are distinct), where $a_i$ is the programming skill of the $i$-th student.


-----Output-----

For each query, print the answer on it — the minimum number of teams you can form if no two students $i$ and $j$ such that $|a_i - a_j| = 1$ may belong to the same team (i.e. skills of each pair of students in the same team has the difference strictly greater than $1$)


-----Example-----
Input
4
4
2 10 1 20
2
3 6
5
2 3 4 99 100
1
42

Output
2
1
2
1



-----Note-----

In the first query of the example, there are $n=4$ students with the skills $a=[2, 10, 1, 20]$. There is only one restriction here: the $1$-st and the $3$-th students can't be in the same team (because of $|a_1 - a_3|=|2-1|=1$). It is possible to divide them into $2$ teams: for example, students $1$, $2$ and $4$ are in the first team and the student $3$ in the second team.

In the second query of the example, there are $n=2$ students with the skills $a=[3, 6]$. It is possible to compose just a single team containing both students.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
x = int(input())
for i in range(x):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	c = 0
	for j in range(1, n):
		if a[j] - a[j - 1] == 1:
			c = c + 1
			break
	if c > 0:
		print('2')
	else:
		print('1')


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = [-1] * n
	temp = 0
	for i in range(n):
		if ans[i] == -1:
			ans[i] = temp + 1
			t = a[i]
			for j in range(i + 1, n):
				if ans[j] == -1 and a[j] - t > 1:
					ans[j] = temp + 1
					t = a[j]
			temp += 1
	print(temp)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))[:n]
	a.sort()
	count = 0
	if len(a) == 1:
		print('1')
	else:
		for i in range(len(a) - 1):
			if a[i + 1] - a[i] == 1:
				count = count + 1
		if count == 0:
			print('1')
		else:
			print('2')


groups = ''
for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	group = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			group = 2
			break
	groups += str(group) + '\n'
print(groups)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 1
	for j in range(n - 1):
		for k in range(j + 1, n):
			if abs(a[j] - a[k]) == 1:
				ans = 2
	print(ans)


q = int(input())
for _ in range(q):
	n = int(input())
	arr = set(map(int, input().split()))
	c = 1
	check = False
	for a in arr:
		if a - 1 in arr:
			check = True
			break
	print('2' if check else '1')


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	flag = 1
	a.sort()
	for j in range(n - 1):
		diff = a[j + 1] - a[j]
		if diff == 1:
			flag = 0
	if flag == 1:
		print(1)
	else:
		print(2)


q = int(input())
c = []
k = 1
for i in range(0, q):
	n = int(input())
	for a in input().split():
		c.append(int(a))
	c.sort()
	for j in range(1, n):
		if c[j] == c[j - 1] - 1 or c[j] == c[j - 1] + 1:
			k += 1
			break
	print(k)
	k = 1
	c = []


n = eval(input())
for i in range(n):
	students = eval(input())
	students_list = list(map(int, input().split()))
	sol = 1
	for k in range(students):
		if sol == 2:
			break
		for j in range(k + 1, students):
			if abs(students_list[j] - students_list[k]) == 1:
				sol += 1
				break
	print(sol)


for _ in range(int(input())):
	le = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = 0
	for i in range(0, le - 1):
		if l[i + 1] - l[i] == 1:
			f = 1
			break
	if f == 0:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	flag = 0
	l1 = list(map(int, input().split()))
	l1.sort()
	for i in range(n - 1):
		if l1[i + 1] - l1[i] == 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


q = int(input())
inp = []
for i in range(q):
	input()
	inp.append(set(map(int, input().split())))
for s in inp:
	print([1, 2][any((e - 1 in s for e in s))])


q = int(input())
for m in range(q):
	counteams = 1
	n = int(input())
	a = list(map(int, input().split()))
	if len(a) > 1:
		for i in range(len(a) - 1):
			for j in range(i + 1, len(a)):
				if abs(a[i] - a[j]) == 1:
					counteams = 2
		print(counteams)
	else:
		counteams = 1
		print(counteams)


gi = lambda : list(map(int, input().split()))
for k in range(gi()[0]):
	(n,) = gi()
	l = set(gi())
	print('12'[True in [e + 1 in l for e in l]])


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	one_team = True
	for i in range(1, n):
		if arr[i] - arr[i - 1] == 1:
			one_team = False
			break
	if one_team:
		print(1)
	else:
		print(2)


testCaseNum = int(input())
for testCase in range(testCaseNum):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	flag = False
	for i in range(1, n):
		if arr[i - 1] + 1 == arr[i]:
			flag = True
			break
	if flag:
		print(2)
	else:
		print(1)


q = int(input())

def check_valid(lst):
	temp = [lst[0]]
	index = 0
	summing = 1
	while index < len(lst) - 1 and summing + index < len(lst):
		if abs(lst[index] - lst[index + summing]) != 1:
			temp.append(lst[index + summing])
			index += summing
			summing = 1
		else:
			summing += 1
	return temp
for i in range(q):
	n = int(input())
	list_st = sorted(list(map(int, input().split(' '))))
	ans = 0
	while list_st:
		temp = check_valid(list_st)
		for l in temp:
			list_st.remove(l)
		ans += 1
	print(ans)


q = int(input())
for i in range(q):
	f = True
	n = int(input())
	a = [int(i) for i in input().split()]
	for j in range(n):
		for k in range(n):
			if abs(a[j] - a[k]) == 1:
				print(2)
				f = False
				break
		if not f:
			break
	if f:
		print(1)


a = int(input())
for i in range(a):
	b = int(input())
	c = sorted(list(map(int, input().split())))
	cont = [[-1]]
	for e in c:
		add = False
		for j in range(len(cont)):
			if e - cont[j][-1] > 1:
				cont[j].append(e)
				add = True
				break
		if not add:
			cont.append([e])
	print(len(cont))


R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	L = sorted(R())
	f = 0
	for i in range(1, n):
		if L[i] - L[i - 1] == 1:
			f = 1
			break
	if f:
		print(2)
	else:
		print(1)


a = input()
for i in range(int(a)):
	pri = False
	b = input()
	c = list(map(int, input().split(' ')))
	c.sort()
	for j in range(len(c) - 1):
		if c[j + 1] - c[j] == 1:
			print(2)
			pri = True
			break
	if pri == False:
		print(1)


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	arrf = []
	for x in range(len(arr) - 1):
		arrf.append(arr[x] - arr[x + 1])
	if 1 in arrf or -1 in arrf:
		print(2)
	else:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(j) for j in input().split()]
	ans = 1
	a.sort()
	for x in range(1, n):
		if abs(a[x] - a[x - 1]) == 1:
			ans = 2
	print(ans)


n = int(input())
b = []
for i in range(n):
	s = 0
	k = 1
	q = int(input())
	a = [int(x) for x in input().split()]
	for j in range(q):
		for c in range(q):
			if a[j] - a[c] == 1:
				k += 1
				s += 1
	if k > 1 and s > 1:
		k = k - (s - 1)
	elif k > 2 and s == 1:
		k = k - 1
	b.append(k)
for i in range(len(b)):
	print(b[i])


q = int(input())
for i in range(0, q):
	n = int(input())
	a = input()
	p = list(map(int, a.split(' ')))
	p.sort()
	flag = 0
	for j in range(0, n - 1):
		for k in range(1, n):
			if p[k] - p[j] == 1:
				flag = flag + 1
	if flag == 0:
		print('1')
	else:
		print('2')


n = int(input())
for i in range(n):
	m = int(input())
	mass = [int(x) for x in input().split()]
	mass.sort()
	ch = 1
	for i in range(1, m):
		if mass[i - 1] + 1 == mass[i]:
			ch = 2
			break
	print(ch)


tc = int(input())
for _ in range(tc):
	n = int(input())
	flag = 0
	l = list(map(int, input().split()))
	count = 0
	l.sort()
	for i in range(1, n):
		if l[i] - l[i - 1] == 1:
			print(2)
			flag = 1
			break
	if flag == 0:
		print(1)


for _ in range(int(input())):
	n = int(input())
	l = list(set((int(s) for s in input().split())))
	l.sort()
	teams = 0
	flag = 0
	for i in range(1, n):
		if l[i] - l[i - 1] == 1:
			flag = 1
			break
	if flag:
		print(2)
	else:
		print(1)


import sys
input = sys.stdin.readline

def solve(n, arr):
	teams = 1
	for i in range(n - 1):
		if arr[i + 1] - arr[i] == 1:
			teams = 2
	return teams
q = int(input())
for _ in range(q):
	n = int(input())
	arr = sorted(map(int, input().split()))
	print(solve(n, arr))


q = int(input())
for query in range(q):
	n = int(input())
	As = sorted([int(x) for x in input().split()])
	teams = [[As[0]]]
	for i in range(1, n):
		found = False
		for team in teams:
			if As[i] - team[-1] > 1:
				team.append(As[i])
				found = True
				break
		if not found:
			teams.append([As[i]])
	print(len(teams))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(n - 1):
		if l[i + 1] - l[i] == 1:
			print(2)
			break
	else:
		print(1)


n = int(input())
for i in range(n):
	x = int(input())
	arr = list(map(int, input().split()))
	ans = []
	for i in range(x):
		for j in range(x):
			if abs(arr[i] - arr[j]) == 1:
				ans.append(1)
				break
	if len(arr) < 2:
		print(1)
	elif 1 in ans:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	print(1 + any((a[i + 1] - a[i] == 1 for i in range(n - 1))))


import math
z = int(input())
for i in range(z):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	count = 1
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] == 1:
			count += 1
		if count > 1:
			print(2)
			break
	if count == 1:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	s = sorted(list(map(int, input().split())))
	ans = 1
	for j in range(n - 1):
		if s[j + 1] - s[j] == 1:
			ans = 2
			break
	print(ans)


from sys import stdin, stdout
q = int(stdin.readline())
for i in range(q):
	n = int(stdin.readline())
	flag = 0
	arr = [int(x) for x in stdin.readline().split()]
	arr.sort()
	for i in range(1, n):
		if arr[i] - arr[i - 1] == 1:
			flag = 1
			break
	if flag == 1:
		stdout.write('2' + '\n')
	else:
		stdout.write('1' + '\n')


n = int(input())
for i in range(0, n):
	o = int(input())
	p = input().rstrip().split(' ')
	p.sort(key=int)
	V = 0
	for j in range(1, len(p)):
		if int(p[j]) - int(p[j - 1]) == 1:
			V = 1
			break
	if V == 0:
		print(1)
	else:
		print(2)


from sys import stdin
q = int(stdin.readline().rstrip())
for _ in range(q):
	n = int(stdin.readline().rstrip())
	data = [int(x) for x in stdin.readline().rstrip().split()]
	data.sort()
	ans = 0
	flag = False
	for i in range(n - 1):
		if abs(data[i] - data[i + 1]) == 1:
			if flag:
				ans += 1
			flag = True
			ans = 1
		else:
			flag = False
	print(ans + 1)


for step in range(int(input())):
	n = int(input())
	A = [int(i) for i in input().split()]
	A.sort()
	k = 0
	for i in range(1, n):
		if abs(A[i - 1] - A[i]) == 1:
			k += 1
	if k == 0:
		print(1)
	else:
		print(2)


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = []
	ans.append([l[0]])
	for i in range(1, n):
		j = 0
		flag = 0
		for j in range(len(ans)):
			flag = 0
			for k in ans[j]:
				if abs(l[i] - k) == 1:
					flag = 1
					break
			if flag == 0:
				break
		if flag == 0:
			ans[j].append(l[i])
		else:
			ans.append([l[i]])
	print(len(ans))
	t -= 1


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	for i in range(n - 1):
		if abs(l[i + 1] - l[i]) == 1:
			c = 1
			break
	if c:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	diff = []
	for i in range(n - 1):
		diff.append(a[i + 1] - a[i])
	count = 0
	for x in diff:
		if x == 1:
			count += 1
	if count:
		print(2)
	else:
		print(1)


q = int(input())

def check(n, a):
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			return 2
	return 1
for _ in range(q):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	print(check(n, a))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	x = [0] * n
	for i in range(n):
		if x[i] == 0:
			o = l[i]
			x[i] = 1
			for j in range(i + 1, n):
				if l[j] - o > 1 and x[j] == 0:
					o = l[j]
					x[j] = 1
			ans = ans + 1
	print(ans)


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = sorted(map(int, stdin.readline().split()))
	res = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			res = 2
			break
	print(res)


q = int(input())
while q > 0:
	n = int(input())
	arr = map(int, input().split())
	lst = [[]]
	flg = False
	for i in arr:
		for j in lst:
			if i + 1 in j or i - 1 in j:
				flg = True
				break
			else:
				j.append(i)
				break
	if flg:
		print(2)
	else:
		print(1)
	q -= 1


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	c = 1
	for i in a:
		if i - 1 in a:
			c = 2
			break
	print(c)


t = int(input())
for i in range(0, t):
	n = int(input())
	x = [int(x) for x in input().split()]
	x.sort()
	c = 0
	for j in range(0, n - 1):
		if x[j] == x[j + 1] - 1:
			c = c + 1
			break
	if c == 1:
		print('2')
	else:
		print('1')


t = int(input())
ans = []
b = []
k = 0
for i in range(t):
	w = int(input())
	a = list(map(int, input().split(' ')))
	for j in range(w - 1):
		for z in range(w - 1):
			if abs(a[j] - a[z + 1]) == 1:
				k += 1
	if k >= 1:
		ans.append(2)
	else:
		ans.append(1)
	k = 0
for i in ans:
	print(i)


import sys, math
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	q = 1
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] <= 1:
			q = 2
			break
	print(q)


def main():
	q = int(input())
	for i in range(q):
		n = int(input())
		arr = list(map(int, input().split()))
		arr.sort()
		found = False
		for j in range(n - 1):
			if arr[j + 1] - arr[j] == 1:
				found = True
				break
		if found:
			print(2)
		else:
			print(1)
main()


from sys import stdin
input = stdin.readline
from heapq import heapify, heappush, heappop, heappushpop
from collections import defaultdict as dd, deque as dq, Counter as C
from math import factorial as f, ceil, gcd, sqrt, log
from bisect import bisect_left as bl, bisect_right as br
from itertools import combinations as c, permutations as p
from math import factorial as f, ceil, gcd, sqrt, log
mp = lambda : map(int, input().split())
it = lambda : int(input())
ls = lambda : list(input().strip())
mt = lambda r: [list(mp()) for _ in range(r)]
lcm = lambda a, b: a * b // gcd(a, b)

def fibo_n(n):
	return ((1 + sqrt(5)) / 2) ** n / sqrt(5)
mod = 1000000007
for _ in range(it()):
	n = it()
	l = sorted(mp())
	ans = 1
	for i in range(1, n):
		if l[i] - l[i - 1] == 1:
			ans += 1
			break
	print(ans)


nqueries = int(input())
outputs = []
for query in range(nqueries):
	nstudents = int(input())
	skills = [int(k) for k in input().split()]
	skills.sort()
	twoTeams = False
	ind = 0
	while not twoTeams and ind < nstudents - 1:
		if abs(skills[ind] - skills[ind + 1]) == 1:
			twoTeams = True
		ind += 1
	if twoTeams:
		outputs.append(2)
	else:
		outputs.append(1)
for o in outputs:
	print(o)


import math
amount = int(input())
for i in range(amount):
	n = int(input())
	array = [int(s) for s in input().split()]
	counter = 0
	array = sorted(array)
	for i in range(1, len(array)):
		if array[i - 1] + 1 == array[i]:
			counter += 1
	if counter == 0:
		print(1)
	else:
		print(2)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	rest = [0] * 101
	for j in range(len(a)):
		rest[a[j]] += 1
	flag = False
	m = 1
	for j in range(1, len(rest)):
		if rest[j] == rest[j - 1] == 1:
			flag = True
		m += rest[j] - 1 if rest[j] > 1 else 0
	print(m if not flag else m + 1)


q = int(input())
for i in range(q):
	n = int(input())
	x = input()
	y = x.split()
	z = [int(d) for d in y]
	z.sort()
	a = []
	for i in range(len(z) - 1):
		a.append(z[i + 1] - z[i])
	if 1 in a:
		print('2')
	else:
		print('1')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	f = False
	for i in range(n - 1):
		if f:
			break
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) == 1:
				f = True
				break
	if not f:
		print(1)
	else:
		print(2)


q = int(input())
list = []
for query in range(q):
	n = int(input())
	v = [int(x) for x in input().split()]
	v.sort()
	teamNr = 1
	for i in range(n - 1):
		if abs(int(v[i + 1]) - int(v[i])) == 1:
			teamNr += 1
			break
	list.append(teamNr)
for el in list:
	print(el)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	fg = 0
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) == 1:
			fg = 1
			break
	if fg == 1:
		print(2)
	else:
		print(1)


import sys
input = sys.stdin.readline
n = int(input())
for _ in range(n):
	m = int(input())
	x = list(map(int, input().split()))
	x.sort()
	xo = 0
	prev = -1
	for a in x:
		if a - prev > 1:
			xo += 1
		prev = a
	if xo == m or m == 1:
		print('1')
	else:
		print('2')


def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import math
q = ii()
for i in range(q):
	n = ii()
	a = li()
	a.sort()
	f = 0
	for i in range(n - 1):
		if a[i] - a[i + 1] == -1:
			f += 1
	if f:
		print(2)
	else:
		print(1)


def main():
	queries = int(input())
	for _ in range(queries):
		total_students = int(input())
		students = list(map(int, input().split()))
		if total_students == 1:
			print('1')
		else:
			students.sort()
			if total_students == 2:
				if students[1] - students[0] == 1:
					print('2')
				else:
					print('1')
			else:
				is_pair_exist = False
				for i in range(len(students) - 1):
					if students[i + 1] - students[i] == 1:
						is_pair_exist = True
						break
				if is_pair_exist:
					print('2')
				else:
					print('1')
main()


import math
tc = int(input().strip())
while tc > 0:
	tc -= 1
	n = int(input().strip())
	arr = list(map(int, input().strip().split()))
	ans = 0
	arr = sorted(arr)
	for i in range(1, n):
		if arr[i] - arr[i - 1] == 1:
			ans += 1
	if ans:
		print(2)
	else:
		print(1)


for cases in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	team = 1
	for i in range(1, N):
		if L[i - 1] == L[i] - 1:
			team = 2
			break
	print(team)


q = int(input())
for sub_q in range(q):
	n = int(input())
	A = sorted([int(i) for i in input().split()])
	if n == 1:
		print(1)
	else:
		for j in range(1, n):
			if A[j] - A[j - 1] == 1:
				print(2)
				break
		else:
			print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	count = 1
	for k in range(n - 1):
		c = l[k]
		if count == 2:
			break
		for i in range(k + 1, n):
			if abs(c - l[i]) == 1:
				count += 1
				break
	print(count)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	for i in a:
		if i + 1 in a or i - 1 in a:
			flag = 1
			break
	if flag:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	size = int(input())
	array = sorted(list(map(int, input().split())))
	if size != 1 and 1 in [array[i] - array[i - 1] for i in range(1, size)]:
		print(2)
	else:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	for i in range(n - 1):
		if arr[i] + 1 == arr[i + 1]:
			print(2)
			break
	else:
		print(1)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if n == 1:
		print(1)
	else:
		for i in range(1, n):
			if a[i] - a[i - 1] == 1:
				print(2)
				break
		else:
			print(1)
for _ in range(int(input())):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	f = 0
	if len(a) == 1:
		print(1)
	else:
		for i in range(len(a) - 1):
			if a[i + 1] - a[i] <= 1:
				f = 1
				break
		if f == 1:
			print(2)
		else:
			print(1)


import math

def calc(n: int, arr: list):
	arr.sort()
	ans: int = 0
	tmp: int = -1
	for i in range(n):
		if i == 0:
			tmp: int = arr[0]
			continue
		elif 1 == arr[i] - tmp:
			ans += 1
		tmp = arr[i]
	if ans == 0:
		return 1
	else:
		return 2

def main():
	for _ in range(int(input())):
		n: int = int(input())
		arr: list = list(map(int, input().split()))
		print(calc(n, arr))
main()


import sys
q = int(input())
for _ in range(q):
	n = int(input())
	a = sorted([int(x) for x in input().split()])
	r = 1
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			r = 2
			break
	print(r)


for _ in range(int(input())):
	input()
	l = list(map(int, input().split()))
	l.sort()
	print(1 + any([l[i] == l[i - 1] + 1 for i in range(1, len(l))]))


def main(n, a):
	index = 0
	td = False
	while index < n:
		x = index + 1
		while x < n:
			if abs(a[index] - a[x]) == 1:
				td = True
			x = x + 1
		index = index + 1
	if td:
		return 2
	else:
		return 1
q = int(input())
for q_itr in range(q):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	res = main(n, a)
	print(res)


n = int(input())
a = []
q = []
for i in range(n):
	k = int(input())
	q = list(map(int, input().strip().split()))[:k]
	q.sort()
	a.append(q)
for i in range(n):
	out = 1
	q = a[i]
	for j in range(1, len(q)):
		if q[j] - q[j - 1] == 1:
			out = 2
	print(out)


from sys import stdin
from math import *
for i in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	ans = 1
	for j in range(n):
		for k in range(j + 1, n):
			if abs(ar[j] - ar[k]) == 1:
				ans = 2
	print(ans)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 1
	for j in range(n - 1):
		if abs(a[j] - a[j + 1]) <= 1:
			c += 1
			break
	print(c)


t = int(input())
for _ in range(t):
	(n, ok) = (int(input()), 0)
	a = list(map(int, input().split()))
	a.sort()
	for i in range(0, n - 1):
		if a[i + 1] - a[i] == 1:
			ok = 1
	print([1, 2][ok])


Q = int(input())
for _ in range(Q):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	for i in range(N - 1):
		if A[i + 1] - A[i] == 1:
			print(2)
			break
	else:
		print(1)


import sys
input = sys.stdin.readline

def main():
	q = int(input())
	for _ in range(q):
		N = int(input())
		A = [int(x) for x in input().split()]
		S_A = sorted(A)
		ans = 1
		for i in range(1, N):
			if S_A[i] - S_A[i - 1] == 1:
				ans += 1
				break
		print(ans)
main()


q = int(input())
for i in range(q):
	n = int(input())
	teams = 1
	students = list((int(i) for i in input().split()))
	students = sorted(students)
	for i in range(n - 1):
		if students[i + 1] - students[i] == 1:
			teams += 1
	if teams > 1:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	s = set()
	c = 0
	for i in a:
		if i not in s:
			s.add(i - 1)
			s.add(i + 1)
		else:
			c += 1
	if c > 0:
		print('2')
	else:
		print('1')


n = int(input())
for i in range(n):
	_ = int(input())
	a = list(map(int, input().split()))
	a.sort()
	res = list()
	for i in range(len(a)):
		if len(res) == 0:
			res.append([a[i]])
			continue
		if a[i] - res[-1][-1] > 1:
			res[-1].append(a[i])
		elif len(res) == 1:
			res.append([a[i]])
		else:
			res[-2].append(a[i])
	print(len(res))


q = int(input())
for l in range(q):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	a.sort()
	b = []
	c = []
	b.append(a[0])
	for _ in range(1, n):
		if abs(a[_ - 1] - a[_]) == 1:
			c.append(a[_])
		else:
			b.append(a[_])
	if len(c) > 0:
		print(2)
	else:
		print(1)


test = int(input())
for a in range(0, test):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	flag = 0
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			if abs(arr[i] - arr[j]) == 1:
				flag = 1
				break
	if flag == 1:
		print('2')
	else:
		print('1')


def count(ele, n):
	count = 0
	for i in range(1, n):
		if ele[i] - ele[i - 1] == 1:
			count += 1
	if count > 0:
		return 2
	else:
		return 1
	return 0
test = int(input())
for _ in range(test):
	n = int(input())
	ele = list(map(int, input().split()))
	ele.sort()
	print(count(ele, n))


def teams_counter(skills):
	res = 1
	bucket_1 = [skills[0]]
	for i in range(1, len(skills)):
		if abs(skills[i] - bucket_1[-1]) > 1:
			bucket_1.append(skills[i])
		else:
			res = 2
			break
	return res
q = int(input())
for i in range(q):
	size = int(input())
	skills = sorted(map(int, input().split()))
	print(teams_counter(skills))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			ans = 2
			break
	print(ans)


q = int(input())
for i in range(q):
	n = int(input())
	x = sorted(list(map(int, input().split(' '))))
	flag = False
	for j in range(n):
		if x[j] - x[j - 1] == 1:
			print(2)
			flag = True
			break
	if flag == False:
		print(1)


testes = int(input())
for t in range(testes):
	alunos = int(input())
	habilidades = input().split(' ')
	for k in range(alunos):
		habilidades[k] = int(habilidades[k])
	habilidades.sort()
	times = 1
	for i in range(alunos - 1):
		if abs(habilidades[i] - habilidades[i + 1]) <= 1:
			times = 2
			break
	print(times)


t = int(input())
for q in range(t):
	n = int(input())
	arr = []
	c = 1
	arr = list(map(int, input().split()))
	arr.sort()
	for i in range(n - 1):
		if arr[i + 1] - arr[i] == 1:
			c = 2
	print(c)


for i in range(int(input())):
	m = int(input())
	b = list(map(int, input().split(' ')))
	c = sorted(b)
	e = 0
	for j in range(0, m - 1):
		if c[j + 1] - c[j] == 1:
			e += 1
	if e >= 1:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	q = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(q - 1):
		if -1 <= a[i] - a[i + 1] <= 1:
			print(2)
			break
	else:
		print(1)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	cnt = 1
	for j in range(n - 1):
		if a[j + 1] - a[j] == 1:
			cnt = 2
	print(cnt)


for _ in range(int(input())):
	x = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	ans = [lst[0]]
	for i in lst[1:]:
		ret = 1
		for ii in range(len(ans)):
			if abs(ans[ii] - i) > 1:
				ret = 0
				ans[ii] = i
				break
		if ret:
			ans.append(i)
	print(len(ans))


c = 0
q = int(input())
for i in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	prev = -10000
	s = []
	while arr:
		counter = 0
		for item in arr:
			if abs(prev - item) <= 1:
				s.append(item)
				counter += 1
			else:
				prev = item
		arr = s
		c += 1
		prev = -10000
		if counter == 0:
			break
	print(c)
	c = 0


def task_1(students, values):
	commands = list()
	sorted_values = sorted(values)
	previos = None
	comands = 1
	current_command = 1
	for current in sorted_values:
		if previos is None:
			pass
		elif current - previos == 1:
			if current_command > 1:
				current_command -= 1
			else:
				current_command += 1
		else:
			current_command = 1
		previos = current
		comands = max(comands, current_command)
	print(comands)
q = int(input())
for q in range(q):
	(students,) = map(int, input().rstrip().split())
	values = list(map(int, input().rstrip().split()))
	task_1(students, values)


q = int(input())
for i in range(q):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	flag = -1
	for j in range(n - 1):
		if abs(A[j] - A[j + 1]) == 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


queries = int(input())
for q in range(queries):
	n = int(input())
	nums = [int(i) for i in input().split(' ')]
	nums = sorted(nums)
	prev = nums[0]
	count = 1
	prevcount = 0
	curr = 0
	for i in nums:
		if i == prev:
			curr += 1
		else:
			count = max(prevcount + curr, count)
			prevcount = curr
			curr = 1
			if abs(int(prev) - int(i)) > 1:
				prevcount = 0
			prev = i
	count = max(prevcount + curr, count)
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr1 = sorted(arr)
	a = []
	for i in range(len(arr1)):
		for j in range(i, len(arr1)):
			if arr1[j] - arr1[i] == 1:
				a.append(arr1[i])
	if len(a) >= 1:
		print(2)
	else:
		print(1)


def R():
	return map(int, input().split())
t = int(input())
for i in range(t):
	n = int(input())
	a = R()
	a = set(a)
	fl = True
	for j in a:
		if j + 1 in a:
			print('2')
			fl = False
			break
	if fl:
		print('1')


n = int(input())
for i in range(n):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	l = s[0]
	ans = 1
	for skill in s[1:]:
		if skill - l == 1:
			ans = 2
			break
		l = skill
	print(ans)


q = int(input())
s = []
for i in range(q):
	n = int(input())
	s.extend((int(x) for x in input().split()))
	max = 0
	for x in s:
		nr = 0
		if x + 1 in s:
			nr = s.count(x + 1)
		if nr > max:
			max = nr
	print(max + 1)
	s.clear()


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	mint()
	a = list(mints())
	a.sort()
	(b, c) = (None, None)
	for i in a:
		if i - 1 == b:
			c = i
		else:
			b = i
	print(int(b != None) + int(c != None))
for i in range(mint()):
	solve()


try:

	def fun(n, l):
		for i in range(n):
			for j in range(n):
				if abs(l[j] - l[i]) == 1:
					return '2'
		return '1'
	t = int(input())
	for _ in range(t):
		n = int(input())
		l = list(map(int, input().split()))
		ans = fun(n, l)
		print(ans)
except:
	pass


def canGo(n, t):
	for s in t:
		if abs(s - n) < 2:
			return False
	return True
for case in range(int(input())):
	teams = [[]]
	students = int(input())
	inp = input().split(' ')
	team1 = set()
	team2 = set()
	blah = False
	for s in range(len(inp)):
		s = int(inp[s])
		if s - 1 not in team1 and s + 1 not in team1:
			team1.add(s)
		else:
			print(2)
			blah = True
			break
	if blah:
		continue
	print(1)


from collections import defaultdict
T = int(input())
for _ in range(T):
	Q = int(input())
	C = sorted(map(int, input().split()))
	d = defaultdict(list)
	d[0].append(C[0])
	for i in range(1, Q):
		c = 0
		while abs(d[c][-1] - C[i]) <= 1:
			c += 1
			if not d[c]:
				break
		d[c].append(C[i])
	print(len(d))


import sys
from math import ceil
cin = sys.stdin.buffer.readline
for _ in range(int(cin())):
	n = int(cin())
	a = list(map(int, cin().split()))
	a.sort()
	ans = 1
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			ans = 2
			break
	freq = [0] * 101
	for el in a:
		freq[el] += 1
	print(max(ans, max(freq)))


def solve(arr, n):
	hash = {i: 1 for i in arr}
	for elem in arr:
		if hash.get(elem + 1) != None:
			print('2')
			return
	print('1')
	return

def main():
	q = int(input())
	while q:
		q -= 1
		n = int(input())
		arr = [int(i) for i in input().split()]
		solve(arr, n)
	return
main()


q = int(input())
while q > 0:
	q = q - 1
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	ans = 1
	if n == 1:
		print(1)
	else:
		for i in range(1, n):
			if A[i] == A[i - 1] + 1:
				ans = 2
		print(ans)


for _ in range(int(input())):
	found = False
	sn = int(input())
	ls = list(map(int, input().split()))
	ls.sort()
	for i in range(0, sn):
		for j in range(1, sn):
			if abs(ls[i] - ls[j]) == 1:
				found = True
				break
	if found == False:
		print('1')
	else:
		print('2')


q = int(input())
for i in range(q):
	rep = 0
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for j in range(n - 1):
		if abs(l[j] - l[j + 1]) == 1:
			rep = 1
	if rep:
		print('2\n')
	else:
		print('1\n')


answers = []
for i in range(int(input())):
	x = input()
	lst = list(map(int, input().split()))
	a = lst.sort()
	teams = 0
	for i in lst:
		for j in lst:
			if i - j == 1 or i - j == 1:
				teams += 1
	if teams > 0:
		answers.append(2)
	else:
		answers.append(1)
for i in answers:
	print(i)


t = int(input())
b = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b.append(a)
for i in b:
	i.sort()
	p = 0
	j = 0
	while j < len(i) - 1:
		if i[j + 1] - i[j] == 1:
			p = 1
			break
		j += 1
	if p == 1:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = 0
	if n == 1:
		print(1)
	else:
		for t in range(1, n):
			if l[t] - l[t - 1] == 1:
				f = 1
				break
		if f:
			print(2)
		else:
			print(1)


def solve():
	input()
	arr = [int(x) for x in input().split()]
	a = [None] * 102
	for i in arr:
		a[i] = True
	maxi = 1
	i = 0
	while i < len(a) - 1:
		if a[i] and a[i + 1]:
			print(2)
			return
		i += 1
	print(1)

def main():
	t = int(input())
	while t > 0:
		solve()
		t -= 1
main()


t = int(input())

def solve():
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	otv = 1
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			otv = 2
	print(otv)
for i in range(t):
	solve()


from collections import deque
import math

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())
t = ii()
while t:
	n = ii()
	a = li()
	a.sort()
	f = 0
	for i in range(1, n):
		if a[i] - a[i - 1] < 2:
			f = 1
			break
	if f == 1:
		print('2')
	else:
		print('1')
	t -= 1


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	x.sort()
	fg = 0
	for j in range(n - 1):
		if x[j] + 1 == x[j + 1]:
			fg = 1
			break
	if fg:
		print(2)
	else:
		print(1)


for i in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	(i, j) = (1, 1)
	while i < n:
		if a[i] - a[i - 1] == 1:
			j = 2
			break
		i += 1
	print(j)


q = int(input())
for _ in range(q):
	n = int(input())
	A = [int(x) for x in input().split()]
	A.sort()
	flag = 0
	for i in range(1, n):
		if A[i] - A[i - 1] == 1:
			flag = 1
			break
	if flag == 0:
		print(1)
	else:
		print(2)


def program():
	n = int(input())
	l = list(map(int, input().split()))
	temp = []
	for x in l:
		if x + 1 in temp or x - 1 in temp:
			print('2')
			return 0
		temp.append(x)
	print('1')
t = int(input())
for i in range(t):
	program()


q = int(input())
for i in range(q):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	c = 0
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			c += 1
	if c >= 1:
		print(2)
	else:
		print(1)


x = int(input())
mst = []
for i in range(0, x):
	c = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	j = 0
	count = 0
	while j < len(lst) - 1:
		if lst[j + 1] - lst[j] == 1:
			count = 1
			break
		j += 1
	mst.append(2 if count == 1 else 1)
print(*mst, sep='\n')


n = int(input().strip())
for i in range(n):
	q = int(input().strip())
	nums = [int(i) for i in input().strip().split()]
	nums.sort()
	one = True
	for j in range(1, q):
		if nums[j] - nums[j - 1] == 1:
			one = False
			break
	print(1 if one else 2)


for _ in ' ' * int(input()):
	z = int(input())
	a = sorted(list(map(int, input().split())))
	for i in range(z - 1):
		if abs(a[i] - a[i + 1]) < 2:
			print(2)
			break
	else:
		print(1)


q = int(input())
a = []
k = 0
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = 0
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			k += 1
			break
	if n == 1:
		print(1)
	elif k == 0:
		print(1)
	else:
		print(2)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ans = 1
	for i in range(1, len(a)):
		if a[i] == a[i - 1] + 1:
			ans += 1
			break
	print(ans)


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	n = inp()
	l = li()
	l.sort()
	c = 1
	for i in range(n - 1):
		if l[i + 1] - l[i] == 1:
			c += 1
			break
	print(c)
for _ in range(inp()):
	solve()


import math
for q in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			c = 2
	print(c)


n = int(input())
for i in range(n):
	d = input()
	s = input()
	new = s.split()
	imp = []
	for char in new:
		imp.append(int(char))
	imp.sort()
	p = None
	a = 0
	for num in imp:
		if num - 1 == p:
			print(2)
			a = 9
			break
		p = num
	if a == 0:
		print(1)


for _ in ' ' * int(input()):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	f = 0
	f1 = 0
	for i in range(n):
		if a[i] + 1 in a:
			f = 1
			break
	print(2 if f == 1 else 1)


a = int(input())
list_a = [0] * a
for x in range(a):
	t = 1
	b = int(input())
	list_b = [0] * b
	list_b = list(map(int, input().strip().split()))[:b]
	list_b.sort()
	for y in range(len(list_b) - 1):
		if list_b[y + 1] - list_b[y] == 1:
			t = 2
	list_a[x] = t
print(*list_a, sep='\n')


def main():
	Q = int(input())
	for query in range(Q):
		_ = int(input())
		A = [int(i) for i in input().split()]
		A.sort()
		flag = False
		pre = A[0]
		for a in A[1:]:
			if a - pre <= 1:
				flag = True
				break
			pre = a
		if flag:
			print(2)
		else:
			print(1)
main()


n = int(input())
for i in range(n):
	m = int(input())
	S = [int(i) for i in input().split()]
	S = sorted(S)
	ss = 0
	for k in range(len(S) - 1):
		if S[k + 1] - S[k] == 1:
			ss = 1
			break
	if ss == 1:
		print(2)
	else:
		print(1)


q = int(input())
for i in range(q):
	a = int(input())
	trouve = False
	tab = list(map(int, input().split()))
	for (j, k) in zip(sorted(tab)[:-1], sorted(tab)[1:]):
		if abs(j - k) == 1:
			trouve = True
	if not trouve or a == 1:
		print(1)
	else:
		print(2)


def fun(a):
	dif = []
	a = sorted(a)
	l = len(a)
	for i in range(l - 1):
		d = abs(a[i] - a[i + 1])
		if d == 1:
			return True
	else:
		return False
n = int(input())
for i in range(n):
	m = int(input())
	a = [int(x) for x in input().split()]
	if fun(a):
		print(2)
	else:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	count = 0
	[a.append(int(x)) for x in input().split()]
	for j in a:
		if j + 1 in a:
			count += 1
	if count > 0:
		print(2)
	else:
		print(1)


n = int(input())
for i in range(n):
	k = input()
	isDouble = False
	arr = list(map(int, input().split()))
	arr.sort()
	eStart = arr[0]
	for e in range(1, len(arr)):
		if arr[e] - eStart == 1:
			isDouble = True
			break
		else:
			eStart = arr[e]
	if isDouble:
		print(2)
	else:
		print(1)


t = int(input())
for tt in range(t):
	n = int(input())
	a = input().split()
	for x in range(n):
		a[x] = int(a[x])
	a.sort()
	kmax = 0
	k = 0
	for x in range(1, n):
		if a[x] == a[x - 1] + 1:
			kmax = 100
			break
	if kmax == 0:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print([1, 2][any((e - 1 in a for e in a))])


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	print(2 if [1 for a0 in A for a1 in A if a1 - a0 == 1] else 1)


for j in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	cnt = 0
	for i in range(len(arr) - 1):
		if arr[i + 1] - arr[i] == 1:
			cnt += 1
	if cnt == 0:
		print(1)
	else:
		print(2)


for i in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	a = []
	c = 0
	for i in range(n - 1):
		if abs(l[i + 1] - l[i]) == 1:
			c = 1
	if c == 0:
		print(1)
	else:
		print(2)


q = int(input())
for query in range(q):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a = sorted(a)
	res = 1
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) == 1:
			res = 2
			break
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	m = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			m = 2
	print(m)


t = int(input())
while t:
	t -= 1
	n = int(input())
	li = list(map(int, input().split()))
	count = 0
	li.sort()
	i = 0
	flag = 0
	while flag == 0 and i < n - 1:
		if li[i] - li[i + 1] == -1:
			flag = 1
		i += 1
	if flag == 0:
		print('1')
	else:
		print('2')


q = int(input())
for _ in range(q):
	n = int(input())
	it = list(map(int, input().split()))
	it.sort()
	st = 1
	for i in range(n - 1):
		if abs(it[i] - it[i + 1]) == 1:
			st = 2
	print(st)


q = int(input())
while q > 0:
	q = q - 1
	n = int(input())
	a = []
	a = list(map(int, input().split()))
	a.sort()
	f = 0
	for i in range(len(a) - 1):
		if a[i] + 1 == a[i + 1]:
			f = 1
	print(1 + f)


Q = int(input())
for _ in range(Q):
	N = int(input())
	A = sorted([int(x) for x in input().split()])
	flg = False
	for i in range(len(A) - 1):
		if A[i + 1] - A[i] == 1:
			print(2)
			flg = True
			break
	if not flg:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = True
	for i in range(1, n):
		if l[i] - l[i - 1] == 1:
			flag = False
			break
	if flag:
		print(1)
	else:
		print(2)


import sys

def main():
	for tc in range(int(input())):
		n = int(input())
		arr = get_array()
		arr.sort()
		f = 0
		for i in range(1, n):
			if arr[i] == 1 + arr[i - 1]:
				f = 1
		if f == 1:
			print(2)
		else:
			print(1)
get_array = lambda : list(map(int, sys.stdin.readline().split()))
get_ints = lambda : list(map(int, sys.stdin.readline().split()))
input = lambda : sys.stdin.readline().strip()

def __starting_point():
	main()
__starting_point()


q = int(input())
for _ in range(q):
	n = int(input())
	ls = list(map(int, input().split()))
	ls.sort()
	two_commands = False
	for i in range(n - 1):
		if ls[i] + 1 == ls[i + 1]:
			two_commands = True
			break
	if two_commands:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n_students = int(input())
	s = set(map(int, input().split()))
	res = 0
	if n_students == 1:
		res = 1
	elif any((e - 1 in s for e in s)):
		res = 2
	else:
		res = 1
	print(str(res))


from copy import copy

def arr_float_inp():
	return [float(s) for s in input().split()]

def arr_int_inp():
	return [int(s) for s in input().split()]

def int_inp():
	return int(input())

def float_inp():
	return float(input())
for _ in range(int_inp()):
	teams = []
	n = int_inp()
	arr = arr_int_inp()
	flag = True
	for i in range(0, len(arr) - 1):
		for j in range(i + 1, len(arr)):
			if abs(arr[j] - arr[i]) == 1:
				flag = False
				break
	if flag:
		print(1)
	else:
		print(2)


q = int(input())
for i in range(q):
	n = int(input())
	k = sorted([int(i) for i in input().split()])
	p = 1
	for j in range(1, len(k)):
		if k[j] - 1 == k[j - 1]:
			p += 1
			break
	print(p)


q = int(input())
for _ in range(q):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ans = 1
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] == 1:
			ans = 2
	print(ans)


tcs = int(input())
for _ in range(tcs):
	n = int(input())
	stu = list(map(int, input().split()))
	stu.sort()
	visited = [0] * n
	visited[0] = 0
	for i in range(1, n):
		if abs(stu[i] - stu[i - 1]) == 1:
			visited[i] = (visited[i - 1] + 1) % 2
		else:
			visited[i] = visited[i - 1]
	print(max(visited) + 1)


def func(a, n):
	a.sort()
	for i in range(0, n - 1):
		dif = a[i + 1] - a[i]
		if dif == 1:
			return 2
	else:
		return 1
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans.append(func(a, n))
for i in ans:
	print(i)


q = int(input())
for _ in range(q):
	f = 0
	input()
	a = sorted([int(i) for i in input().split()])
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) == 1:
			print(2)
			f = 1
			break
	if f == 0:
		print(1)


import math
t = int(input())
for ii in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	ls.sort()
	flag = 0
	for i in range(n - 1):
		if ls[i + 1] - ls[i] == 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


def R():
	return map(int, input().split())
(q,) = R()
for _ in [0] * q:
	R()
	a = set(R())
	print(bool(a & {x + 1 for x in a}) + 1)


def tests():
	n = int(input())
	skili = list(map(int, input().split()))
	skili.sort()
	for e in range(1, len(skili)):
		if abs(skili[e] - skili[e - 1]) == 1:
			return 2
	return 1
t = int(input())
for q in range(t):
	print(tests())


test = int(input())

def check():
	n = int(input())
	lst = list(map(int, input().split()))
	a = 1
	for i in lst:
		for j in lst:
			if abs(i - j) == 1:
				a = 2
				break
	print(a)
for k in range(test):
	check()


for j in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 1
	i = 0
	while i < len(l) - 1:
		if l[i + 1] - l[i] == 1:
			ans = 2
		i = i + 1
	print(ans)


a = int(input())
for i in range(a):
	b = int(input())
	c = sorted(list(map(int, input().split())))
	cnt = 1
	for i in range(b - 1):
		if abs(c[i + 1] - c[i]) <= 1:
			cnt = 2
			break
	print(cnt)


for _ in range(int(input())):
	n = int(input())
	array = sorted(map(int, input().split()))
	for i in range(1, n):
		if array[i] - array[i - 1] == 1:
			print(2)
			break
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	teamCount = 1
	lst = [0] * 101
	tmp = list(map(int, input().split()))
	for j in range(len(tmp)):
		lst[tmp[j]] = 1
	for j in range(len(lst) - 1):
		if lst[j] == 1 and lst[j + 1] == 1:
			teamCount = 2
			break
	print(teamCount)


def solve(arr, size):
	teams = 1
	var = arr[0]
	for i in range(1, size):
		if arr[i] - var != 1:
			var = arr[i]
		else:
			teams += 1
			break
	print(teams)
for _ in range(int(input())):
	size = int(input())
	arr = sorted(list(map(int, input().split())))
	solve(arr, size)


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	for i in range(1, n):
		if l[i] - l[i - 1] == 1:
			c = 0
			break
	if c:
		print(1)
	else:
		print(2)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	d = 0
	for j in range(n - 1):
		if a[j + 1] - a[j] == 1:
			d += 1
	if d >= 1:
		print('2')
	else:
		print('1')


def find_and_put(x, sets):
	for s in sets:
		if x - s[-1] > 1:
			s.append(x)
			return
	else:
		sets.append([x])

def solve(n, a):
	a.sort()
	sets = [[a[0]]]
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			sets[0].append(a[i])
		else:
			find_and_put(a[i], sets)
	return len(sets)

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		print(solve(n, a))
main()


mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 6)
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import collections
import math
import heapq
import random

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	t = inin()
	for _ in range(t):
		n = inin()
		a = ain()
		d = {}
		ans = 1
		for i in a:
			d[i] = 1
		for i in a:
			if i + 1 in d:
				ans = 2
		print(ans)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, input().strip().split(' ')))
	a.sort()
	teams = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] <= 1:
			teams = 2
			break
	print(teams)


n = int(input())
for _ in range(n):
	k = int(input())
	arr = sorted(list(map(int, input().split())))
	kk = {}
	counter = 0
	for c in arr:
		flag = True
		for key in kk.keys():
			if abs(kk[key][-1] - c) > 1:
				kk[key].append(c)
				flag = False
				break
		if flag:
			kk.update({counter: [c]})
			counter += 1
	print(len(kk.keys()))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	l.sort()
	for i in range(n - 1):
		x = abs(l[i] - l[i + 1])
		if x == 1 and c < 1:
			c = c + 1
	if c > 0:
		print('2')
	else:
		print('1')


q = int(input())
for i in range(q):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	ret = 0
	h = a[0]
	for j in a:
		if j == -1:
			continue
		for (index, k) in enumerate(a):
			if k == -1:
				h = k
				continue
			if abs(h - k) > 1:
				h = k
				a[index] = -1
		ret += 1
	print(ret)


q = int(input())
n = [0] * q
answer = [1] * q
for i in range(q):
	n[i] = int(input())
	a = [int(x) for x in input().split()]
	for j in range(n[i]):
		for k in range(j + 1, n[i]):
			if abs(a[j] - a[k]) == 1:
				answer[i] = 2
				break
		else:
			continue
		break
for i in answer:
	print(i)


def main():
	t = int(input())
	for cases in range(t):
		n = int(input())
		arr = [int(x) for x in input().split()]
		if n == 1:
			print('1')
			continue
		sorted_arr = sorted(arr)
		flag = False
		for i in range(n - 1):
			if sorted_arr[i + 1] - sorted_arr[i] == 1:
				flag = True
				break
		if flag:
			print('2')
		else:
			print('1')
main()


num = int(input())
while num:
	length = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = 0
	comp = arr[0]
	arr.remove(arr[0])
	i = 0
	while len(arr) != 0:
		if i == len(arr):
			ans += 1
			break
		v = abs(comp - arr[i])
		if v > 1:
			comp = arr[i]
			arr.remove(arr[i])
		else:
			i += 1
	print(ans + 1)
	num -= 1


def minNumOfTeams(skills, n):
	skills.sort()
	pairs = sum([1 for i in range(n - 1) if skills[i] + 1 == skills[i + 1]])
	if pairs >= 1:
		return 2
	return 1
q = int(input())
for i in range(q):
	n = int(input())
	skills = [int(x) for x in input().split()]
	print(minNumOfTeams(skills, n))


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	b.sort()
	l = []
	for i in range(a - 1):
		if b[i + 1] - b[i] == 1:
			l.append(2)
	if len(l) > 0:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	b = set([i - 1 for i in a])
	if len(set(a) & b) == 0:
		print(1)
	else:
		print(2)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 1
	a.sort()
	i = 0
	while i < n - 1:
		if a[i] == a[i + 1] - 1:
			flag = 0
			break
		i += 1
	if flag == 1:
		print(1)
	else:
		print(2)


from math import ceil
from math import factorial
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
t = ii()
for i in range(t):
	n = ii()
	a = iia()
	c = 0
	for j in range(n - 1):
		for k in range(j + 1, n):
			if abs(a[j] - a[k]) <= 1:
				c += 1
	if c == 0:
		print(1)
	else:
		print(2)


q = int(input())
for test in range(0, q):
	n = int(input())
	a = input().split()
	set1 = [int(a[0])]
	set2 = []
	for i in range(1, n):
		x = int(a[i])
		if x - 1 not in set1 and x + 1 not in set1:
			set1.append(x)
		else:
			set2.append(x)
	if len(set2) == 0:
		print(1)
	else:
		print(2)


q = int(input())
for _ in range(q):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr.sort()
	flag = True
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) == 1:
			flag = False
			break
	if flag:
		print(1)
	else:
		print(2)


q = int(input())
queries = []
for _ in range(q):
	n = int(input())
	skills = [int(s) for s in input().split(' ')[:n]]
	queries.append(skills)
for query in queries:
	if any((skill + 1 in query for skill in query)):
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	lst = [int(x) for x in input().split()]
	lst = sorted(lst)
	bad = 1
	for i in range(1, len(lst)):
		if lst[i] == 1 + lst[i - 1]:
			bad = 2
	print(bad)


def func():
	ans = []
	for i in li:
		if i + 1 not in ans and i - 1 not in ans:
			ans.append(i)
		else:
			return 2
	return 1
for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	print(func())


t = int(input())
output = []
for _ in range(t):
	n = int(input())
	list_val = list(map(int, input().split()))
	list_val.sort()
	answer = 1
	for i in range(n - 1):
		if list_val[i + 1] - list_val[i] == 1:
			answer = 2
	output.append(answer)
for x in output:
	print(x)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	diff = 1
	for i in range(n):
		temp = 1
		minus = 0
		plus = 0
		for j in range(n):
			if i != j:
				if a[j] - a[i] == 1:
					minus += 1
				if a[j] - a[i] == -1:
					plus += 1
				if a[i] == a[j]:
					temp += 1
		diff = max(diff, temp + max(minus, plus))
	print(diff)


q = int(input())
for _ in range(q):
	n = int(input())
	ar = [int(i) for i in input().split()]
	ar.sort()
	ans = 1
	for i in range(1, len(ar)):
		if ar[i] == ar[i - 1] + 1:
			ans = 2
			break
	print(ans)


q = int(input())
for i in range(q):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	f = 0
	for i in range(n):
		if i != n - 1:
			if a[i] == a[i + 1] - 1:
				f = 1
				break
	if f == 1:
		print(2)
	else:
		print(1)


for i in range(int(input())):
	(n, check) = (int(input()), 0)
	arr = sorted(list(map(int, input().split())))
	for j in range(n - 1):
		if arr[j + 1] - arr[j] == 1:
			check = 1
	print(2 if check == 1 else 1)


for _ in range(int(input())):
	n = int(input())
	a = [int(__) for __ in input().split()]
	a.sort()
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			print(2)
			break
	else:
		print(1)


def contest(l):
	l.sort()
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) == 1:
			return 2
	return 1
q = int(input())
for i in range(q):
	n = int(input())
	str = input()
	l = str.split()
	l = [int(item) for item in l]
	print(contest(l))


import math as m
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) == 1:
			c = 2
			break
	print(c)


def partition(arr, low, high):
	i = low - 1
	pivot = arr[high]
	for j in range(low, high):
		if arr[j] < pivot:
			i = i + 1
			(arr[i], arr[j]) = (arr[j], arr[i])
	(arr[i + 1], arr[high]) = (arr[high], arr[i + 1])
	return i + 1

def quick_sort(arr, low, high):
	if low < high:
		pi = partition(arr, low, high)
		quick_sort(arr, low, pi - 1)
		quick_sort(arr, pi + 1, high)
no_of_queries = int(input())
for i in range(no_of_queries):
	no_of_student = int(input())
	skill_list = list(map(int, input().split()))
	quick_sort(skill_list, 0, no_of_student - 1)
	j = 0
	k = 1
	result = 1
	while k < no_of_student:
		if skill_list[k] == skill_list[j] + 1:
			result = 2
			break
		k += 1
		j += 1
	print(result)


T = int(input())
for i in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	teams = 1
	for k in range(0, len(arr)):
		for j in range(1, len(arr)):
			if abs(arr[k] - arr[j]) == 1:
				teams += 1
	if teams == 1:
		print('1')
	else:
		print('2')


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	good = True
	for j in range(n - 1):
		if a[j] + 1 == a[j + 1]:
			good = False
			break
	if good:
		print('1\n')
	else:
		print('2\n')


import sys
input = sys.stdin.readline
tc = int(input())
for _ in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = 0
	i = 0
	while i < n - 1:
		if abs(arr[i] - arr[i + 1]) == 1:
			i += 2
			ans += 1
		else:
			i += 1
	if ans == 0:
		print(1)
	else:
		print(2)


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ans = 1
	for i in range(n - 1):
		if a[i] == a[i + 1] - 1:
			ans = 2
			break
	print(ans)


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split(' ')))
	c = 0
	l.sort()
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] == 1:
			c = 1
			print('2')
			break
	if c == 0:
		print('1')


import sys
q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, sys.stdin.readline().split()))
	a = sorted(a)
	a = [1 if abs(x - y) == 1 else 0 for (x, y) in zip(a, a[1:])]
	if sum(a) >= 1:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = input()
	n = [int(i) for i in input().split()]
	n.sort()
	team = 1
	F = True
	for i in n:
		if i + 1 in n:
			if F:
				team += 1
				F = False
				break
	print(team)


from collections import deque

def solve(arr, size):
	arr.sort()
	arr = deque(arr)
	ptr = 0
	teams = []
	while len(arr) > 0:
		temp = []
		var = arr.popleft()
		ptr2 = 0
		while ptr2 < len(arr) and list(arr) != []:
			if ptr2 < len(arr) and abs(var - arr[ptr2]) != 1:
				temp.append(1)
				var = arr[ptr2]
				del arr[ptr2]
			else:
				ptr2 += 1
		teams.append(temp)
	print(len(teams))
for _ in range(int(input())):
	size = int(input())
	arr = list(map(int, input().split()))
	if len(arr) == 1:
		print(1)
	elif len(arr) == 2:
		if abs(arr[0] - arr[1]) == 1:
			print(2)
		else:
			print(1)
	else:
		solve(arr, size)


entrada = int(input())
for k in range(entrada):
	quantidade = int(input())
	programadores = list(map(int, input().split(' ')))
	programadores.sort()
	flag = True
	for k in range(quantidade - 1):
		if abs(programadores[k] - programadores[k + 1]) <= 1:
			flag = False
			break
	if flag:
		print('1')
	else:
		print('2')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	f = 1
	for i in range(1, len(a)):
		if abs(a[i] - a[i - 1]) == 1:
			f = 2
	print(f)


def mi():
	return map(int, input().split())
mod = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	a = list(mi())
	a.sort()
	cnt = 1
	mcnt = 1
	s = a[0]
	for i in range(1, n):
		if a[i] - s <= 1:
			cnt += 1
		else:
			mcnt = max(mcnt, cnt)
			s = a[i]
			cnt = 1
	mcnt = max(cnt, mcnt)
	print(mcnt)


q = int(input())
for i in range(q):
	sL = [[]]
	n = int(input())
	nL = list(map(int, input().split()))
	ans = 1
	for j in nL:
		for h in nL:
			if abs(j - h) == 1:
				ans = 2
				break
		if ans == 2:
			break
	print(ans)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
for _ in range(get_int()):
	n = get_int()
	lst = sorted(get_int_list())
	team = 1
	for i in range(n - 1):
		if lst[i] == lst[i + 1] - 1:
			team = 2
			break
	print(team)


for i in range(int(input())):
	input()
	h = sorted(list(map(int, input().split())))
	for j in range(1, len(h)):
		if h[j - 1] + 1 == h[j]:
			print(2)
			break
	else:
		print(1)


n = int(input())
for i in range(n):
	a = int(input())
	c = 0
	x = list(map(int, input().split()))
	x.sort()
	for i in range(a - 1):
		if x[i] + 1 == x[i + 1]:
			c += 1
	if c > 0:
		print(2)
	else:
		print(1)


for q in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	ans = 1
	if any((abs(i - j) == 1 for i in a for j in a)):
		ans = 2
	print(ans)


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	l = list([])
	for i in range(n):
		if i == 0:
			l.append([arr[i], arr[i]])
		else:
			flag = 0
			for j in range(len(l)):
				if arr[i] - l[j][1] > 1:
					l[j][1] = arr[i]
					flag = 1
					break
			if flag == 0:
				l.append([arr[i], arr[i]])
	print(len(l))


q = int(input())
for _ in range(q):
	n = int(input())
	a = [int(i) for i in input().split()]
	a = sorted(a)
	count = 1
	for i in range(1, n):
		if a[i] == a[i - 1] + 1:
			count = 2
			break
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	students = list(map(int, input().split()))
	students.sort()
	ok = True
	for j in range(n):
		if j > 0:
			if students[j] - students[j - 1] == 1:
				ok = False
				break
	if ok:
		print(1)
	else:
		print(2)


q = int(input())
for i in range(q):
	n = int(input())
	a = sorted([int(x) for x in input().split()])
	for i in range(1, n):
		if a[i] == a[i - 1] + 1:
			print(2)
			break
	else:
		print(1)


for j in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	min_groups = 0
	while arr:
		arr2 = []
		last = arr[0]
		min_groups += 1
		if len(arr) == 1:
			break
		for i in arr:
			if abs(i - last) == 1:
				arr2 += [i]
				continue
			last = i
		arr = arr2
	print(min_groups)


q = int(input())
nums = []
arrs = []
for _ in range(q):
	nums.append(int(input()))
	arrs.append([int(i) for i in input().split()])
for _ in range(q):
	n = nums[_]
	arr = arrs[_]
	arr.sort()
	for i in range(n - 1):
		if arr[i] == arr[i + 1] - 1:
			print(2)
			break
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	skills = list(map(int, input().split()))
	r = 0
	for i in skills:
		for j in skills:
			if j < i and abs(j - i) == 1:
				r += 1
	if r == 0:
		print(1)
	elif r >= 1:
		print(2)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	flag = 0
	for i in l:
		if i + 1 in l:
			flag = 1
	if flag == 1:
		print('2')
	else:
		print('1')


t = int(input())
for w in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	s = 1
	for i in range(n - 1):
		if l[i + 1] - l[i] == 1:
			s = 2
			break
	print(s)


q = int(input())
while q > 0:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	f = 0
	for i in range(n - 1):
		if a[i] + 1 == a[i + 1]:
			f = 1
			break
	if f == 1:
		print(2)
	else:
		print(1)
	q = q - 1


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 1000000007

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))
ans = 0

def dfs(visited, node, digits, tree):
	if not visited[node]:
		visited[node] = True
		digits += str(node)
		leafNode = True
		for child in tree[node]:
			leafNode = False
			dfs(visited, child, digits, tree)
		if leafNode:
			global ans
			ans += int(digits)

def main():
	n = int(input())
	arr = array()
	arr.sort()
	prev = None
	ans = 0
	for i in range(n):
		if prev == None:
			ans += 1
			prev = arr[i]
		elif prev + 1 < arr[i]:
			ans += 1
			prev = arr[i]
	if ans < n:
		print(2)
	else:
		print(1)
t = int(input())
for _ in range(t):
	main()


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	flag = False
	for i in range(1, n):
		flag |= a[i] == a[i - 1] + 1
	print(flag + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	b = False
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			b = True
	print(int(b) + 1)


n = int(input())
for _ in range(n):
	_ = int(input())
	ns = [int(x) for x in input().split()]
	ns.sort()
	lista = []
	for i in ns:
		if len(lista) == 0:
			lista.append([i])
		else:
			j = 0
			c = True
			while j < len(lista) and c:
				k = 0
				e = False
				while k < len(lista[j]) and (not e):
					if abs(i - lista[j][k]) <= 1:
						e = True
					k += 1
				if not e:
					c = False
					lista[j].append(i)
				j += 1
			if c:
				lista.append([i])
	print(len(lista))


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	(p, q) = (0, 0)
	for i in range(1, n):
		if a[i] == a[i - 1] + 1:
			p += 1
	if p > 0:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	for q in range(len(a) - 1):
		if a[q] == a[q + 1] - 1:
			print(2)
			break
	else:
		print(1)


import sys

def main():
	q = int(sys.stdin.readline())
	solns = []
	for _ in range(q):
		n = int(sys.stdin.readline())
		a = [int(x) for x in sys.stdin.readline().split(' ')]
		a.sort()
		offByOne = False
		for i in range(n - 1):
			if a[i] == a[i + 1] - 1:
				offByOne = True
				break
		if offByOne:
			solns += [2]
		else:
			solns += [1]
	return solns
print('\n'.join((str(x) for x in main())))


cases = int(input())
for _ in range(cases):
	n = int(input())
	arr = [int(i) for i in input().split(' ')]
	arr.sort()
	conseq = False
	for i in range(1, len(arr)):
		if arr[i - 1] + 1 == arr[i]:
			conseq = True
			break
	if conseq:
		print('2')
	else:
		print('1')


for i in range(int(input())):
	n = int(input())
	A = [int(x) for x in input().split()]
	count = 1
	for i in range(n):
		for j in range(i, n):
			if abs(A[i] - A[j]) == 1:
				count = count + 1
	if count >= 2:
		print(2)
	else:
		print(count)


q = int(input())
for i in range(q):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	f = True
	for j in range(1, len(s)):
		if s[j] - s[j - 1] == 1:
			f = False
			break
	print(1) if f else print(2)


test = int(input())
for j in range(test):
	n = int(input())
	skill = list(map(int, input().split()))
	if n == 1:
		print(1)
	else:
		skill.sort()
		team = 1
		for i in range(n - 1):
			if skill[i + 1] - skill[i] == 1:
				team = 2
		print(team)


temp = 0
q = int(input())
for i in range(q):
	mas = []
	n = int(input())
	mas = input().split()
	count = 0
	for i in range(n):
		for j in range(n):
			if int(mas[i]) - int(mas[j]) == 1:
				count += 1
	if count == 1 and len(mas) > 1:
		print('2')
	elif count == 0:
		print('1')
	elif count % 2 == 0:
		print('2')
	elif count % 2 != 0 and count >= 2:
		print('2')
	else:
		print('1')
	count = 0


q = int(input())
for _ in range(q):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	f = False
	for i in range(len(a) - 1):
		if a[i] + 1 == a[i + 1]:
			f = True
			break
	if f:
		print('2')
	else:
		print('1')


q = int(input())
i = 0
while i < q:
	n = int(input())
	a = list(input().split())
	first = int(a[0])
	group = 0
	mass = []
	MASS = []
	for j in a:
		j = int(j)
		mass.append(j)
	while len(mass) != 0:
		MASS.append(min(mass))
		ind = mass.index(min(mass))
		del mass[ind]
	answer = 1
	j = 0
	while j != len(MASS) - 1:
		if MASS[j] + 1 == MASS[j + 1]:
			answer += 1
		j += 1
	if answer > 2:
		answer = 2
	print(answer)
	i += 1


n = int(input())
for i in range(n):
	m = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	k = 1
	for i in range(1, len(a)):
		if a[i] == a[i - 1] + 1:
			k = 2
			break
	print(k)


def findmteam(a, n):
	l = []
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) == 1:
				return 2
	return 1
q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	k = findmteam(a, n)
	print(k)


def sequence(rating):
	rating.sort()
	p = rating[0]
	for j in rating:
		if j - p == 1:
			return True
		else:
			p = j
requests_count = int(input())
for i in range(requests_count):
	stud_count = int(input())
	stud_rat = list(map(int, input().split(' ')))
	if sequence(stud_rat):
		print(2)
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	onetwo = 1
	for j in range(n - 1):
		if a[j + 1] - a[j] == 1:
			onetwo = 2
			break
	print(onetwo)


q = int(input())
while q != 0:
	n = int(input())
	l = []
	c = 1
	l = sorted(list(map(int, input().split())))
	for i in range(n - 1):
		if l[i + 1] - l[i] == 1:
			c = 2
	print(c)
	q -= 1


t = int(input())
while t != 0:
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	team = 1
	i = 0
	while i < n - 1:
		if abs(arr[i + 1] - arr[i]) == 1:
			team = 2
			break
		i += 1
	print(team)
	t = t - 1


totNo = int(input())
for mm in range(totNo):
	noStudent = int(input())
	allStud = list(map(int, input().split()))
	allStud.sort()
	flag = 5
	for i in range(len(allStud) - 1):
		if abs(allStud[i] - allStud[i + 1]) <= 1:
			flag = 1
			break
	if flag == 5:
		print(1)
	else:
		print(2)


q = int(input())
for i in range(q):
	ok = 0
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for x in range(len(a) - 1):
		if not ok:
			if abs(a[x] - a[x + 1]) == 1:
				print(2)
				ok = 1
	if ok:
		continue
	print(1)


t = int(input())
for counter in range(t):
	n = int(input())
	ans = 1
	a = [0] * 101
	for x in input().split():
		a[int(x)] = 1
		if int(x) <= 99 and a[int(x) + 1] == 1 or (int(x) > 1 and a[int(x) - 1] == 1):
			ans = 2
	print(ans)


from itertools import *
q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	cnt = 1
	while len(a) > 1:
		a = list(a)
		b = []
		for i in range(1, len(a)):
			if a[i] - a[i - 1] <= 1:
				b.append(a[i])
		if not b:
			break
		else:
			cnt += 1
		a = set(a) - set(b)
	print(cnt)


q = int(input())
for i in range(q):
	opa = 0
	count = 1
	s = 0
	n = int(input())
	x = list(map(int, input().split()))
	x.sort()
	for j in range(n - 1):
		if x[j + 1] - x[j] == 1:
			opa = 1
	if opa == 1:
		print(2)
	else:
		print(1)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
import bisect
import heapq
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	f = False
	n = int(inp())
	a = sorted(lis())
	for i in range(0, n - 1):
		if a[i + 1] - a[i] == 1:
			f = True
			break
	if f:
		print(2)
	else:
		print(1)
testcase(int(inp()))


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	isOne = True
	for j in range(n - 1):
		if a[j + 1] == a[j]:
			ans += 1
		elif a[j + 1] - a[j] == 1 and isOne:
			ans += 1
			isOne = False
	print(ans)


queries = int(input())
for x in range(queries):
	n = int(input())
	query = input()
	query = query.split()
	query = [int(x) for x in query]
	query.sort()
	count = 0
	for x in range(len(query)):
		try:
			if query[x + 1] - query[x] > 1:
				continue
			else:
				count += 1
		except:
			continue
	if count > 0:
		print(2)
	else:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	flag = False
	for i in range(0, n - 1):
		if a[i + 1] - a[i] == 1:
			flag = True
			break
	if flag:
		print(2)
	else:
		print(1)


q = int(input())
for p in range(q):
	n = int(input())
	a = [int(s) for s in input().split()]
	b = True
	a = sorted(a)
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			b = False
			break
	if b == True:
		print(1)
	else:
		print(2)


q = int(input())
for _ in range(q):
	n = int(input())
	s = [int(x) for x in input().split()]
	s = sorted(s)
	flag = 0
	for i in range(0, len(s) - 1):
		if s[i + 1] - s[i] == 1:
			print(2)
			flag = 1
			break
	if flag == 0:
		print(1)


q = int(input().strip())
while q > 0:
	n = int(input().strip())
	arr = [int(c) for c in input().strip().split(' ')]
	arr = sorted(arr)
	num_team = 1
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) < 2:
			num_team = 2
	print(num_team)
	q -= 1


def skillteam(n, l):
	for item in l:
		if item + 1 in l or item - 1 in l:
			return 2
	return 1
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(skillteam(n, l))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	i = 0
	g = 0
	while i < len(l) and g == 0:
		j = 0
		while j < len(l) and g == 0:
			if i != j:
				h = abs(l[j] - l[i])
				if h == 1:
					g = 1
			j = j + 1
		i = i + 1
	if g == 1:
		print(2)
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	nums = list(map(int, input().split()))
	inc = 0
	nums.sort()
	for j in range(n - 1):
		if nums[j + 1] - nums[j] == 1:
			inc += 1
	if inc > 0:
		print('2')
	else:
		print('1')


for _ in range(int(input())):
	b = []
	x = int(input())
	a = list(map(int, input().split()))
	for i in range(x):
		for t in range(i, x):
			b.append(abs(a[i] - a[t]))
	if 1 in b:
		print(2)
	else:
		print(1)


n = eval(input())
for i in range(n):
	f = 0
	x = eval(input())
	ls = list(map(int, input().split()))
	for k in range(x + 1):
		for j in range(k + 1, x):
			if ls[k] - ls[j] == 1:
				f = 1
			elif ls[j] - ls[k] == 1:
				f = 1
	if f == 1:
		print('2')
	elif f == 0:
		print('1')


q = int(input())
for k in range(q):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	a.sort()
	b = False
	for i in range(n - 1):
		if a[i] + 1 == a[i + 1]:
			b = True
	if b:
		print(2)
	else:
		print(1)


query = int(input())
for _ in range(query):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	check = [0] * n
	count = 0
	for i in range(n):
		if check[i] == 0:
			tempt = [arr[i]]
			count += 1
			for j in range(i + 1, n):
				if abs(tempt[len(tempt) - 1] - arr[j]) != 1 and check[j] == 0:
					check[j] = 1
					tempt.append(arr[j])
	print(count)


q = int(input())
answers = list()
l = 0
while l < q:
	n = int(input())
	levels = input()
	levels = levels.split()
	i = 0
	while i < n:
		levels[i] = int(levels[i])
		i = i + 1
	levels.sort()
	count = 0
	flags = list()
	j = 0
	while j < n:
		flags.append(0)
		j = j + 1
	flags[0] = 1
	size = 1
	if n >= 2:
		j = 1
		while j < n:
			if levels[j] - levels[j - 1] > 1 or flags[j - 1] == 0:
				flags[j] = 1
				size = size + 1
			j = j + 1
	count = 1
	i = 0
	while i < n:
		if flags[i] == 0:
			count = 2
			break
		i = i + 1
	answers.append(count)
	l = l + 1
l = 0
while l < q:
	print(answers[l])
	l = l + 1


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	N = int(input())
	A = list(map(int, input().split()))
	Query.append((N, A))
for (N, A) in Query:
	C = set(A)
	ok = True
	for c in C:
		if c + 1 in C or c - 1 in C:
			ok = False
	print(1 if ok else 2)


q = int(input())
l = []
for i in range(q):
	n = int(input())
	a = sorted([int(k) for k in input().split(' ')])
	teams = 1
	for p in range(1, n):
		if a[p] - a[p - 1] == 1:
			teams = 2
	l.append(teams)
print('\n'.join((str(teams) for teams in l)))


def answer():
	n = int(input())
	while n:
		a = int(input())
		b = [int(x) for x in input().split()]
		b.sort()
		c = []
		i = 0
		while i < len(b):
			j = 0
			targ = b[i]
			homeless = 1
			while j < len(c):
				cell = c[j]
				k = 0
				ruined = 0
				while k < len(cell):
					mate = cell[k]
					if abs(mate - targ) == 1:
						ruined = 1
						break
					k += 1
				if not ruined:
					cell.append(targ)
					homeless = 0
					break
				j += 1
			if homeless:
				c.append([targ])
			i += 1
		print(len(c))
		n -= 1
answer()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = 0
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			flag = 1
			break
	print(1 + flag)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	ans = 0
	while a:
		cur = []
		for aa in a:
			if not cur or aa > cur[-1] + 1:
				cur.append(aa)
		for c in cur:
			del a[a.index(c)]
		ans += 1
	print(ans)


t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	li.sort()
	poss = 1
	for i in range(n - 1):
		if li[i + 1] - li[i] == 1:
			poss = 0
			break
	if poss:
		print(1)
	else:
		print(2)


for i in range(int(input())):
	n = int(input())
	arr = sorted(map(int, input().split()))
	all_together = True
	for i in range(1, n):
		if arr[i] == arr[i - 1] + 1:
			all_together = False
	print(1 if all_together else 2)


try:
	from sys import stdin
	t = int(stdin.readline())
	for z in range(t):
		n = int(stdin.readline())
		a = list(map(int, input().split()))
		a.sort()
		c = 1
		for i in range(1, n):
			if a[i] - a[i - 1] <= 1:
				c = 2
				break
		print(c)
except:
	pass


import math

def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def lcd(a, b):
	return a * b // gcd(a, b)

def input_int():
	return list(map(int, input().split()))

def solve():
	[n] = input_int()
	li = input_int()
	li.sort()
	group = 1
	for i in range(1, n):
		if li[i] - li[i - 1] == 1:
			group = 2
			break
	print(group)
	return
[n] = input_int()
for _ in range(0, n):
	solve()


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	Q = int(input())
	for _ in [0] * Q:
		N = int(input())
		A = list(map(int, input().split()))
		A.sort()
		for i in range(N - 1):
			if A[i + 1] - A[i] == 1:
				print(2)
				break
		else:
			print(1)
main()


import math

def solve(n, a):
	for i in range(1, len(a)):
		if math.fabs(a[i] - a[i - 1]) == 1:
			return 2
	return 1
for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	print(solve(n, a))


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	for i in range(n):
		if arr[i] + 1 in arr or arr[i] - 1 in arr:
			print(2)
			break
	else:
		print(1)


t = int(input())
for i in range(t):
	q = int(input())
	N = input().split()
	if q == 1:
		print(1)
	else:
		n = list(map(int, N))
		n.sort()
		s = []
		for i in range(q - 1):
			k = n[i + 1] - n[i]
			if k == 1:
				s.append(1)
		r = len(s)
		if r > 0:
			print(2)
		else:
			print(1)


import sys
import os
from io import IOBase, BytesIO
import math
mod = 10 ** 9 + 7
pie = 3.1415926536

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def ain():
	return list(map(int, sin().split()))

def sin():
	return input().strip()

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def read2DIntArray(row, col):
	arr = []
	for i in range(0, row):
		temp = list(map(int, sin().split()))
		arr.append(temp)
	return arr

def read2DCharArray(row, col):
	arr = []
	for i in range(0, row):
		temp = str(sin())
		arr.append(temp)
	return arr

def smallestNumber(n):
	lst = list(str(n))
	lst.sort()
	tmp = ''
	for (i, n) in enumerate(lst):
		if n != '0':
			tmp = lst.pop(i)
			break
	return str(tmp) + ''.join(lst)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	lst = []
	for p in range(n + 1):
		if prime[p]:
			lst.append(p)
	return lst

def nCr(n, r):
	a = 1
	b = 1
	c = 1
	for i in range(1, n + 1):
		c *= i
	for i in range(1, r + 1):
		b *= i
	for i in range(1, n - r + 1):
		a *= i
	return c // (a * b)

def sieveOfEratosthenes1(N, s):
	prime = [False] * (N + 1)
	for i in range(2, N + 1, 2):
		s[i] = 2
	for i in range(3, N + 1, 2):
		if prime[i] == False:
			s[i] = i
			for j in range(i, int(N / i) + 1, 2):
				if prime[i * j] == False:
					prime[i * j] = True
					s[i * j] = i

def generatePrimeFactors(N):
	s = [0] * (N + 1)
	sieveOfEratosthenes1(N, s)
	curr = s[N]
	cnt = 1
	factors = []
	power = []
	while N > 1:
		N //= s[N]
		if curr == s[N]:
			cnt += 1
			continue
		factors.append(curr)
		power.append(cnt)
		curr = s[N]
		cnt = 1
	return (factors, power)

def main():
	for _ in range(int(sin())):
		n = int(sin())
		arr = ain()
		flag = 0
		for i in range(n - 1):
			for j in range(i, n):
				if abs(arr[i] - arr[j]) == 1:
					flag = 1
					break
		if flag == 1:
			print('2')
		else:
			print('1')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = []
	ans.append([l[0]])
	for i in range(1, n):
		j = 0
		flag = 0
		for j in range(len(ans)):
			flag = 0
			for k in ans[j]:
				if abs(l[i] - k) == 1:
					flag = 1
					break
			if flag == 0:
				break
		if flag == 0:
			ans[j].append(l[i])
		else:
			ans.append([l[i]])
	print(len(ans))
	t -= 1


def task_1(students, values):
	commands = list()
	previos = None
	sorted_values = sorted(values)
	for current in sorted_values:
		if previos is None:
			pass
		elif current - previos == 1:
			print(2)
			return
		previos = current
	print(1)
q = int(input())
for q in range(q):
	(students,) = map(int, input().rstrip().split())
	values = list(map(int, input().rstrip().split()))
	task_1(students, values)


def ans(n):
	count = 0
	flag = 0
	l = []
	sum = 0
	for i in range(0, len(n), 1):
		for j in range(0, len(n), 1):
			if n[i] - n[j] == 1:
				flag = 1
	return flag
t = int(input())
while t > 0:
	a = int(input())
	l = list(map(int, input().split()))
	if ans(l) == 1:
		print(2)
	else:
		print(1)
	t -= 1


Q = int(input())
for q in range(Q):
	cnt = int(input())
	student = sorted(list(map(int, input().split())))
	answer = []
	for idx in range(len(student) - 1):
		if abs(student[idx] - student[idx + 1]) == 1:
			answer.append(student[idx])
	if answer == []:
		print(1)
	elif len(answer) != len(student):
		print(2)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	f = 1
	li.sort()
	for i in range(1, len(li)):
		if li[i] - li[i - 1] == 1:
			f = 2
			break
	if f == 1:
		print(1)
	else:
		print(2)


q = int(input())
for k in range(q):
	stds = int(input())
	skills = sorted(list(map(int, input().split())))
	if stds == 1:
		print(1)
		continue
	flag = False
	for i in range(stds - 1):
		if skills[i + 1] - skills[i] == 1:
			flag = True
			break
	if flag:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	l = sorted(list(map(int, input().rstrip().split())))
	print([1, 2][any((l[i] - l[i - 1] == 1 for i in range(1, n)))])


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(j) for j in input().split()[:n]]
	f = 0
	for k in range(len(l)):
		if l[k] + 1 in l or l[k] - 1 in l:
			f += 1
			break
		else:
			pass
	if f > 0:
		print(2)
	else:
		print(1)


q = int(input())
while q:
	t = 1
	q -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if n > 1:
		for i in range(n - 1):
			if a[i + 1] - a[i] == 1:
				t += 1
	if t == 1:
		print(1)
	else:
		print(2)


import math

def YetAnotherDividingintoTeams(s):
	sortl = sorted(s)
	for i in range(0, len(sortl) - 1):
		if sortl[i] - sortl[i + 1] == -1:
			print(2)
			return
	print(1)
for i in range(0, int(input())):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	YetAnotherDividingintoTeams(a)


for i in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	res = 1
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			res = 2
	print(res)


mod = 10 ** 9 + 7
import sys
from sys import stdin, stdout
for _ in range(int(input())):
	n = int(input())
	a = [int(n) for n in input().split()]
	a = sorted(a)
	f = 0
	for i in range(1, n):
		if a[i - 1] + 1 == a[i]:
			f = 1
			break
	if f == 1:
		print(2)
	else:
		print(1)


from sys import stdin

def main():
	querys = int(stdin.readline())
	for query in range(querys):
		n = int(stdin.readline())
		nums = list(map(int, stdin.readline().strip().split()))
		nums.sort()
		ans = 1
		for i in range(n - 1):
			if abs(nums[i] - nums[i + 1]) == 1:
				ans = 2
				break
		print(ans)
main()


q = int(input())
for i in range(q):
	r = 1
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	for j in range(n - 1):
		if l[j + 1] - l[j] == 1:
			r = 2
	print(r)


def solve(n, a_s):
	a_set = set(a_s)
	for a in a_s:
		if a > 1 and a - 1 in a_set:
			return 2
		if a < 100 and a + 1 in a_set:
			return 2
	return 1
t = int(input())
for _ in range(t):
	n = int(input())
	a_s = [int(r) for r in input().split(' ')]
	print(solve(n, a_s))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	count = 0
	arr = list(map(int, input().split()))
	arr.sort()
	if n == 1:
		print('1')
	else:
		for i in range(1, n):
			if arr[i] - arr[i - 1] == 1:
				count += 1
		if count > 0:
			print('2')
		else:
			print('1')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().strip().split()))
	l.sort()
	f = True
	for i in range(n - 1):
		if abs(l[i] - l[i + 1]) <= 1:
			f = False
			break
	if f:
		print(1)
	else:
		print(2)


def compute(n, arr):
	dic = dict()
	for i in arr:
		if i - 1 in dic or i + 1 in dic:
			return 2
		dic[i] = 1
	return 1
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(compute(n, arr))


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	for i in x:
		k = [abs(y - i) for y in x]
		if 1 in k:
			print(2)
			break
	else:
		print(1)


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict

def solution(n, arr):
	if n == 1:
		write(1)
		return
	arr.sort()
	for i in range(n - 1):
		if arr[i + 1] - arr[i] <= 1:
			write(2)
			return
	write(1)

def main():
	for _ in range(r_int()):
		n = r_int()
		arr = r_array()
		solution(n, arr)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())

def w_array(arr):
	for x in arr:
		write(x, end=' ')
	write()
main()


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	flag = True
	for i in range(n - 1):
		if a[i + 1] - a[i] <= 1:
			flag = False
			break
	if flag == True:
		print(1)
	else:
		print(2)


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
q = rint()
for _ in range(q):
	n = rint()
	a = sorted(rints())
	two = False
	for i in range(len(a) - 1):
		if a[i] + 1 == a[i + 1]:
			two = True
	print(2 if two else 1)


for _ in range(int(input())):
	a = int(input())
	d = []
	lis = list(map(int, input().split()))
	lis.sort(reverse=True)
	if len(lis) == 1:
		print(1)
	else:
		for i in range(len(lis) - 1):
			lis[i] = lis[i] - lis[i + 1]
		lis.pop()
		if min(lis) == 1:
			print(2)
		else:
			print(1)


for i in range(int(input())):
	n = int(input())
	s = input().split()
	s1 = []
	for e in s:
		s1.append(int(e))
	s = sorted(s1)
	f = True
	for e in range(n):
		if e != n - 1 and abs(int(s[e]) - int(s[e + 1])) <= 1:
			f = False
	if f:
		print(1)
	else:
		print(2)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	c = 1
	s = sorted(a)
	for j in range(n - 1):
		if abs(s[j] - s[j + 1]) == 1:
			c = 2
	print(c)


for i in range(int(input())):
	n = int(input())
	p = input()
	p = list(map(int, p.split()))
	p.sort()
	c = 1
	for j in range(n - 1):
		if abs(p[j + 1] - p[j]) == 1:
			c = 2
	print(c)


listin = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	flag = 0
	ll = listin()
	ll.sort()
	for i in range(n - 1):
		if abs(ll[i] - ll[i + 1]) == 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


n = int(input())
for _ in range(n):
	res = 0
	m = int(input())
	nums = list(map(int, input().split(' ')))
	len1 = len(nums) + 1
	nums = sorted(nums)
	nums.insert(0, -1)
	while m:
		res += 1
		temp = -1
		for j in range(1, len1):
			if nums[j] == -1:
				continue
			elif abs(nums[j] - temp) != 1:
				temp = nums[j]
				nums[j] = -1
				m -= 1
	print(res)


q = int(input())
for i in range(q):
	n = int(input())
	line = input()
	skills = line.split(' ')
	skills = [int(x) for x in skills]
	skills.sort()
	wait_list = []
	for skill in skills:
		breakable = False
		for index in range(len(wait_list)):
			if skill != wait_list[index] + 1:
				wait_list[index] = skill
				breakable = True
				break
		if breakable:
			continue
		else:
			wait_list.append(skill)
	print(len(wait_list))


import sys

def rint():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().rstrip('\n')

def oint():
	return int(input())
q = oint()
for _ in range(q):
	n = oint()
	a = list(rint())
	a.sort()
	cnt = 1
	maxcnt = 1
	for i in range(n - 1):
		if a[i] == a[i + 1] - 1:
			cnt += 1
			maxcnt = max(maxcnt, cnt)
		else:
			cnt = 1
	if maxcnt >= 2:
		print(2)
	else:
		print(1)


for m in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	teams = 1
	for i in range(n):
		for j in range(i + 1, n):
			if teams == 2:
				break
			if a[i] == a[j] + 1 or a[i] == a[j] - 1:
				teams = 2
				break
	print(teams)


q = int(input())
for i in range(q):
	n = int(input())
	arr = sorted([int(x) for x in input().split()])
	b = False
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) == 1:
			b = True
			break
	if b:
		print(2)
	else:
		print(1)


for i in range(int(input())):
	(N, Status) = (int(input()), False)
	X = sorted(list(map(int, input().split())))
	for i in range(1, N):
		if X[i] - X[i - 1] == 1:
			Status = True
			break
	print(2 if Status else 1)


from sys import stdin
import math
t = int(stdin.readline())
while t:
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	k = 1
	if n > 1:
		for i in range(1, n):
			if a[i] - a[i - 1] == 1:
				k = 2
				break
	print(k)
	t -= 1


t = int(input())
for u in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	c = []
	for i in range(n):
		s = 0
		for j in b:
			if abs(a[i] - j) == 1:
				c.append(a[i])
				s = 1
				break
		if s == 0:
			b.append(a[i])
	print
	if len(c) == 0:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	x = 1
	for i in range(1, n):
		if a[i] == a[i - 1] + 1:
			x += 1
			break
	print(x)


t = int(input())
for i in range(t):
	m = int(input())
	s = list(map(int, input().split()))
	f = 0
	s.sort()
	for j in range(m - 1):
		if abs(s[j] - s[j + 1]) == 1:
			f = 1
			break
	if f == 1:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	x = int(input())
	a = list(map(int, input().split()))
	a.sort()
	s = []
	s2 = []
	f = 0
	f1 = 0
	for i in a:
		if len(s) == 0:
			s.append(i)
			f = 1
		elif abs(max(s) - i) > 1:
			s.append(i)
			f = 1
		else:
			f1 = 1
			s2.append(i)
	print(f1 + f)


q = int(input())
for i in range(q):
	n = int(input())
	people = list(map(int, input().split()))
	people.sort()
	for j in range(1, n):
		if people[j] - people[j - 1] == 1:
			print(2)
			break
	else:
		print(1)


for rpt in range(int(input())):
	student_count = int(input())
	students = [int(x) for x in input().split(' ')]
	students.sort()
	one = True
	for i in range(1, student_count):
		if students[i - 1] + 1 == students[i]:
			one = False
	if not one:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = set(map(int, input().split()))
	for i in range(100):
		if i in a and i + 1 in a:
			print(2)
			break
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	man = list(map(int, input().split()))
	flag = True
	man.sort()
	for j in range(n - 1):
		if man[j + 1] - man[j] == 1:
			flag = False
			break
	if flag:
		print(1)
	else:
		print(2)
	man.clear()


for q in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	broken = False
	for i in range(n - 1):
		if A[i] - A[i + 1] == -1:
			broken = True
			break
	if broken:
		print(2)
	else:
		print(1)


q = int(input())

def solve():
	teams = 1
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			teams = 2
			break
	print(teams)
for _ in range(q):
	solve()


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
INF = float('inf')

def getlist():
	return list(map(int, input().split()))

def main():
	Q = int(input())
	for i in range(Q):
		N = int(input())
		a = getlist()
		a = sorted(a)
		ans = 1
		for i in range(1, N):
			if a[i] - a[i - 1] == 1:
				ans = 2
				break
		print(ans)
main()


for q in range(int(input())):
	a = int(input())
	flag = 0
	b = list(map(int, input().split()))
	for i in range(a):
		for j in range(a):
			if abs(b[i] - b[j]) == 1:
				flag = 1
				break
	if flag == 0:
		print(1)
	else:
		print(2)


q = int(input())
count = 0
final = []
while count < q:
	flag = 0
	n = int(input())
	a = input()
	a = [int(x) for x in a.split()]
	a = sorted(a)
	if n == 1:
		final.append(1)
	else:
		for y in range(1, n):
			if a[y] - a[y - 1] == 1:
				final.append(2)
				flag = 1
				break
		if flag == 0:
			final.append(1)
	count += 1
for x in final:
	print(x)


ct = int(input())
for i in range(ct):
	n = int(input())
	li = [int(i) for i in input().split()]
	li.sort()
	flag = False
	for i in range(1, n):
		if li[i] - li[i - 1] == 1:
			flag = True
	if flag:
		print(2)
	else:
		print(1)


T = int(input())
for _ in range(T):
	count = 0
	n = int(input())
	a = sorted(list(map(int, input().split())))
	for i in range(n - 1, 0, -1):
		diff = a[i] - a[i - 1]
		if diff == 1:
			count += 1
			break
	if count == 0:
		print(1)
	else:
		print(2)


q = int(input())
answers = list()
for i in range(q):
	n = int(input())
	scores = list(map(int, input().split(' ')))
	scores = sorted(scores)
	separable = False
	for j in range(0, len(scores) - 1):
		if scores[j + 1] - scores[j] == 1:
			separable = True
			break
	if separable:
		answers.append(2)
	else:
		answers.append(1)
for answer in answers:
	print(answer)


def solve(students):
	students.sort()
	for i in range(len(students) - 1):
		if abs(students[i] - students[i + 1]) == 1:
			return 2
	return 1
num_tests = int(input())
for _ in range(num_tests):
	num_students = int(input())
	answer = solve([int(x) for x in input().split()])
	print(answer)


for i in range(int(input())):
	a = input()
	q = 0
	t = list(map(int, input().split()))
	for j in range(int(a)):
		if t[j] + 1 in t:
			print(2)
			q += 1
			break
	if q == 0:
		print(1)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	temp1 = 0
	temp2 = 0
	if len(a) == 1:
		print(1)
	elif len(a) == 2 and abs(a[0] - a[1]) == 1:
		print(2)
	elif len(a) == 2 and abs(a[0] - a[1] != 1):
		print(1)
	else:
		for i in range(len(a) - 1):
			if abs(a[i] - a[i + 1]) == 1:
				print(2)
				break
		else:
			print(1)


import sys
for _ in range(int(input())):
	n = int(input())
	A = [int(i) for i in input().split()]
	flag = 1
	A.sort()
	for i in range(1, n):
		if abs(A[i] - A[i - 1]) == 1:
			flag = 0
			continue
	if flag:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	flag = 0
	for i in range(n - 1):
		if arr[i] + 1 == arr[i + 1]:
			print(2)
			flag = 1
			break
	if flag == 0:
		print(1)


for i in ' ' * int(input()):
	n = int(input())
	m = sorted([int(i) for i in input().split()])
	t = 1
	for i in range(n - 1):
		if m[i + 1] - m[i] == 1:
			t = 2
	print(t)


n = 0
l = []
q = int(input())
for i in range(q):
	flag = 0
	n = 0
	t = int(input())
	s = list(map(int, input().split()))
	for j in range(t):
		n = n + 1
		for k in range(t - n):
			if abs(s[j] - s[k + n]) == 1:
				flag = 1
				break
		if flag == 1:
			break
	if flag == 1:
		l.append(2)
	if flag == 0:
		l.append(1)
for i in l:
	print(i)


t = int(input())
for i in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = 0
	c = 0
	for j in range(0, n - 1):
		if l[j] == l[j + 1]:
			c = c + 1
		elif l[j + 1] == l[j] + 1:
			f = 1
	if f == 1:
		print(c + f + 1)
	else:
		print(c + 1)


def solve(n, a):
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] <= 1:
			return 2
	return 1

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		print(solve(n, a))
main()


for q in range(int(input())):
	n = int(input())
	l = list(map(int, input().split(' ')))
	l.sort()
	c = 1
	ok = 0
	for i in range(0, len(l) - 1):
		if abs(l[i] - l[i + 1]) == 1:
			print('2')
			ok = 1
			break
	if ok == 0:
		print('1')


for _ in range(int(input())):
	n = int(input())
	main = list(map(int, input().split()))
	main.sort()
	count = 1
	for i in range(len(main) - 1):
		if main[i + 1] - main[i] == 1:
			count = 2
	print(count)


for i in range(int(input())):
	a = input()
	list_of_no = list(map(int, input().split()))
	list_of_no.sort()
	k = []
	for j in range(len(list_of_no) - 1):
		k.append(list_of_no[j + 1] - list_of_no[j])
	if 1 not in k:
		print(1)
	elif 1 in k:
		print('2')


n = int(input())
for g in range(n):
	m = int(input())
	lst = list(map(int, input().split()))
	temp = 0
	for char in lst:
		temp = 0
		for j in lst:
			if char + 1 == j:
				temp += 1
				break
		if temp >= 1:
			print(2)
			break
	if temp == 0:
		print(1)


debug = False
queries = []
if debug:
	with open('test', 'r') as f:
		i = 0
		q = int(f.__next__())
		for _ in range(q):
			f.__next__()
			queries.append([int(i) for i in f.__next__().split(' ')])
else:
	q = int(input())
	for _ in range(q):
		input()
		queries.append([int(i) for i in input().split(' ')])

def solve(query):
	a = set(query)
	for s in query:
		if s + 1 in a or s - 1 in a:
			return '2'
	return '1'
print('\n'.join([solve(query) for query in queries]))


for i in [0] * int(input()):
	a = int(input())
	l = sorted(list(map(int, input().split())))
	for x in range(a):
		try:
			if l[x] - l[x + 1] == -1:
				print('2')
				break
		except:
			print('1')
			break


q = int(input())
for i in range(q):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	if n == 1:
		print('1')
		continue
	delta = [a[i] - a[i - 1] for i in range(1, n)]
	if 1 in delta:
		print('2')
	else:
		print('1')


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		k = I()
		l = LI()
		l.sort()
		a = 1
		for i in range(k - 1):
			if l[i] + 1 == l[i + 1]:
				a = 2
		ans.append(a)
	for x in ans:
		print(x)
main()


for j in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	ans = 1
	for i in range(n - 1):
		if lst[i + 1] - lst[i] == 1:
			ans = 2
			break
	print(ans)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l2 = l.copy()
	l2.sort()
	a = 0
	for i in range(n - 1):
		c = 0
		for j in range(i + 1, n):
			if abs(l2[j] - l2[i]) <= 1:
				c = c + 1
		if c > a:
			a = c
	print(a + 1)


def main():
	q = int(input())
	for _ in [0] * q:
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		judge = True
		for i in range(1, n):
			if a[i] == a[i - 1] + 1:
				judge = False
		if judge:
			print(1)
		else:
			print(2)
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	visited = [0] * n
	itr = 1
	for i in range(n):
		if visited[i] != 0:
			continue
		visited[i] = itr
		root = arr[i]
		for j in range(i + 1, n):
			if visited[j] == 0 and arr[j] - arr[i] > 1 and (arr[j] - root > 1):
				visited[j] = itr
				root = arr[j]
		itr += 1
	print(max(visited))


for _ in range(int(input())):
	n = int(input())
	l = sorted(map(int, input().split()))
	f = 1
	for i in range(1, n):
		if l[i] == l[i - 1] + 1:
			f = 2
	print(f)


q = int(input())
for _ in range(q):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	need_two = False
	for i in range(len(arr) - 1):
		if arr[i + 1] <= arr[i] + 1:
			need_two = True
			break
	if need_two:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	for i in range(n - 1):
		if l[i + 1] - l[i] == 1:
			c += 1
	if c == 0:
		print(1)
	else:
		print(2)


def main():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(n - 1):
		if l[i + 1] - l[i] == 1:
			print(2)
			break
	else:
		print(1)
	return
q = int(input())
for _ in range(q):
	main()


for _ in range(int(input())):
	lens = int(input())
	vals = sorted([int(x) for x in input().split()])
	ans = 1
	for i in range(lens - 1):
		if abs(vals[i] - vals[i + 1]) <= 1:
			ans = 2
			break
	print(ans)


for _ in range(int(input())):
	flag = 0
	n = int(input())
	a = [int(i) for i in input().split()]
	a = set(a)
	for i in a:
		if i + 1 in a:
			print(2)
			flag = 1
			break
		if i - 1 in a:
			print(2)
			flag = 1
			break
	if flag == 0:
		print(1)


def skills(a, n):
	for i in range(1, n):
		for j in range(n):
			if abs(a[j] - a[i]) == 1:
				return True
for q in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	print(2 if skills(a, n) else 1)


n = int(input())
for i in range(n):
	m = int(input())
	li = sorted([int(x) for x in input().split(' ')])
	final = 1
	for j in range(1, len(li)):
		if li[j] - li[j - 1] == 1:
			final += 1
			break
	print(final)


t = int(input())
while t > 0:
	t -= 1
	input()
	l = list(map(int, input().split()))
	l.sort()
	count = 0
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] == 1:
			count = 1
	print(count + 1)


t = int(input())

def fun(n, a):
	a.sort()
	i = 0
	flag = 0
	while i < n - 1:
		if abs(a[i + 1] - a[i]) == 1:
			flag += 1
			break
		i += 1
	if flag == 1:
		print(2)
	else:
		print(1)
while t:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	fun(n, a)


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	d = sorted(l)
	c1 = 0
	i = 0
	v = 0
	if len(l) == 2 and abs(d[i] - d[i + 1]) != 1:
		c1 = 1
	elif len(l) == 2 and abs(d[i] - d[i + 1]) == 1:
		c1 = 2
	elif len(l) == 1:
		c1 = 1
	else:
		while i < len(d) - 1:
			if abs(d[i] - d[i + 1]) == 1 and len(l) > 2:
				v = 1
				i = i + 1
			i = i + 1
		if v == 1:
			c1 = 2
		else:
			c1 = 1
	print(c1)
	t = t - 1


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
for i in range(int(input())):
	n = int(input())
	a = sorted(array())
	m = [a[i] - a[i - 1] for i in range(1, n)]
	if 1 in m:
		print(2)
	else:
		print(1)


import math
from sys import stdin, stdout
q = int(stdin.readline())
for a in range(q):
	n = stdin.readline()
	L = list(map(int, stdin.readline().split()))
	f = True
	L.sort()
	for a in range(0, len(L) - 1):
		if math.fabs(L[a] - L[a + 1]) == 1:
			f = False
			break
	if f == False:
		print(2)
	else:
		print(1)


t = int(input())
while t != 0:
	flag = 0
	t -= 1
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	for i in range(len(l) - 1):
		if l[i] == l[i + 1] - 1:
			print('2')
			flag = 1
			break
	if flag == 0:
		print('1')


for x in range(int(input())):
	n = int(input())
	l = list(map(int, input().strip().split()[:n]))
	l.sort()
	l.append('$#@')
	for x in range(len(l) - 2):
		if l[x + 1] - l[x] <= 1:
			print(2)
			break
	else:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	q = sorted(map(int, input().split()))
	for i in range(1, n):
		if abs(q[i] - q[i - 1]) == 1:
			print(2)
			break
	else:
		print(1)


ll = []
n = int(input())
for x in range(n):
	k = int(input())
	l = list(map(int, input().split()))
	ll.append(l)
for x in ll:
	e = list(enumerate(x))
	r = 1
	for (j, t) in e:
		for (i, tt) in e:
			if i != j and (t == tt or t - tt == 1 or tt - t == 1):
				r = 2
	print(r)


import math
t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	c = 0
	m = True
	if n == 1:
		print(1)
	elif n == 2:
		if abs(arr[0] - arr[1]) > 1:
			print(1)
		else:
			print(2)
	else:
		for i in range(n - 1):
			if abs(arr[i] - arr[i + 1]) <= 1:
				print(2)
				m = False
				break
		if m:
			print(1)
	m = True
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	c = 0
	y = []
	x = list(map(int, input().split()))
	y = sorted(x)
	for j in range(len(y) - 1):
		if abs(y[j + 1] - y[j]) == 1:
			c += 1
			y[j + 1] = 0
	if c == 0:
		print(1)
	else:
		print(2)
	y.clear()


for io in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	c = 0
	for i in range(n - 1):
		if l[i + 1] - l[i] == 1:
			c = 1
			break
	if c == 1:
		print('2')
	else:
		print('1')


import math

def main():
	queries = int(input())
	for _ in range(queries):
		count = int(input())
		skills = list(map(int, input().split()))
		skills.sort()
		result = 1
		for i in range(count - 1):
			if skills[i] - skills[i + 1] == -1:
				result = 2
		print(result)
main()


for _ in range(int(input())):
	n = int(input())
	a = sorted((int(ai) for ai in input().split()))
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			print(2)
			break
	else:
		print(1)


t = int(input())
while t > 0:
	flag = True
	n = int(input())
	list = [int(i) for i in input().split()]
	list.sort()
	for i in range(n - 1):
		if list[i + 1] - list[i] == 1:
			print(2)
			flag = False
			break
	if flag:
		print(1)
	t -= 1


for _ in range(int(input())):
	int(input())
	cnt = 0
	z = [int(x) for x in input().split()]
	for i in z:
		if i - 1 in z or i + 1 in z:
			cnt += 1
	print(2 if cnt > 1 else 1)


def f():
	for k in range(n):
		for p in range(n):
			if ar[k] - ar[p] == 1:
				return 2
	return 1
for k in range(int(input())):
	n = int(input())
	ar = [int(x) for x in input().split()]
	print(f())


t = int(input())
for cnt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	res = 1
	for i in range(n - 1):
		if a[i] == a[i + 1] - 1:
			res = 2
			break
	print(res)


for q in range(int(input())):
	n = int(input())
	d = [int(i) for i in input().split()]
	d.sort()
	bad = False
	for i in range(n - 1):
		if d[i] + 1 == d[i + 1]:
			bad = True
			break
	print([1, 2][bad])


t = int(input())
l = []
for i in range(t):
	x = []
	n = int(input())
	x = [int(x) for x in input().split()]
	l.append(x)
for m in range(len(l)):
	flag = 0
	for j in range(len(l[m])):
		if flag == 1:
			print(2)
			break
		elif j == len(l[m]) - 1:
			print(1)
			break
		else:
			for k in range(j + 1, len(l[m])):
				if abs(l[m][j] - l[m][k]) == 1:
					flag = 1
					break


q = int(input())
for i in range(q):
	student_no = int(input())
	skill = list(map(int, input().split()))
	skill.sort()
	min_team = 1
	for a in range(student_no - 1):
		if skill[a] + 1 == skill[a + 1]:
			min_team = 2
	print(min_team)


from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from heapq import heappush, heappop
import math
import io
import os
import math
import bisect

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def digits(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def ceil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def mapin():
	return map(int, input().split())

def solve(l, n):
	for i in range(1, n):
		if l[i] - l[i - 1] <= 1:
			return 2
	return 1
t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	print(solve(l, n))


def main():
	t = int(input())
	l = []
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		t = 1
		for i in range(1, n):
			if a[i] - a[i - 1] <= 1:
				t = 2
				break
		l.append(t)
	print(*l, sep='\n')
main()


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = False
	for j in range(n):
		if a[j] == a[j - 1] + 1:
			flag = True
			break
	if flag:
		print(2)
	else:
		print(1)


for i in range(int(input())):
	n = int(input())
	x = [*map(int, input().split())]
	x = sorted(x)
	team = 1
	if n == 1:
		print(1)
	elif n == 2:
		if x[1] - x[0] == 1:
			print(2)
		else:
			print(1)
	else:
		for i in range(n - 1):
			if x[i + 1] - x[i] == 1:
				team += 1
		if team >= 2:
			print(2)
		else:
			print(team)


q = int(input())
for i in range(0, q):
	n = int(input())
	a = [int(val) for val in input().split()]
	a.sort()
	flag = True
	for j in range(1, n):
		if a[j] - a[j - 1] == 1:
			flag = False
			break
	if not flag:
		print(2)
	else:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	teams = 0
	li.sort()
	while len(li) != 0:
		p = []
		i = 0
		while i <= len(li) - 1:
			if i < len(li) - 1 and li[i] != li[i + 1] - 1:
				p.append(li[i])
				i = i + 1
			else:
				p.append(li[i])
				i = i + 2
		for j in p:
			li.remove(j)
		teams = teams + 1
	print(teams)


n = int(input())
for i in range(n):
	num = int(input())
	list_of_students = list(map(int, input().split()))
	list_of_students.sort()
	flag = False
	for j in range(len(list_of_students) - 1):
		if list_of_students[j] - list_of_students[j + 1] == 1 or list_of_students[j + 1] - list_of_students[j] == 1:
			flag = True
			break
	if flag:
		print(2)
	else:
		print(1)


def read():
	return list(map(int, input().split()))
q = int(input())
for test in range(q):
	n = int(input())
	a = read()
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) == 1:
			print(2)
			break
	else:
		print(1)


import math
q = int(input())
for _ in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	l = list(set(l))
	team = 1
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) == 1:
			team = team + 1
			break
	print(team)


import sys
import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return '\n'.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True
t = ii()
for i in range(t):
	n = ii()
	a = li()
	if n == 1:
		print(1)
	else:
		a.sort()
		t = 0
		for j in range(n - 1):
			if a[j + 1] - a[j] == 1:
				print(2)
				break
			else:
				t += 1
		if t == n - 1:
			print(1)


def TeamCount(skills):
	k = 0
	while True:
		left = list()
		f = 0
		for i in range(len(skills) - 1):
			if f > 0:
				f -= 1
				continue
			for j in range(i + 1, len(skills)):
				if abs(skills[i] - skills[j]) <= 1:
					left.append(skills[j])
					f += 1
				else:
					break
		k += 1
		skills = left.copy()
		skills.sort()
		if len(left) == 0:
			break
	return k
q = int(input())
for i in range(q):
	n = input()
	skills = list(map(int, input().split()))
	skills.sort()
	print(TeamCount(skills))


for tc in [0] * int(input()):
	n = int(input())
	l = list(map(int, input().split()))
	f = 0
	for i in range(n):
		if l[i] + 1 in l or l[i] - 1 in l:
			f = 1
			print(2)
			break
	if f == 0:
		print(1)


Q = int(input())
for q in range(Q):
	n = int(input())
	L = list(map(int, input().split()))
	L.sort()
	y = 0
	for i in range(1, n):
		if L[i] - L[i - 1] == 1:
			y = 1
	if y == 1:
		print(2)
	else:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	teams = 0
	x = list(map(int, input().split()))
	x.sort()
	x = x[::-1]
	for i in range(len(x)):
		for j in range(i, len(x)):
			if x[i] - x[j] == 1:
				teams += 1
	if teams >= 1:
		print(2)
	else:
		print(1)


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	if a == 1:
		print(1)
	else:
		b = sorted(b)
		r = 0
		for j in range(1, a):
			if b[j] - b[j - 1] == 1:
				r = 1
				break
		if r == 1:
			print(2)
		else:
			print(1)


import re

def read(t=int):
	return list(map(t, input().strip().split(' ')))
q = read()[0]

def check(lis):
	for i in lis:
		for j in lis:
			if i != j and abs(i - j) <= 1:
				return False
	return True
while q > 0:
	q -= 1
	n = read()[0]
	a = read()
	if check(a):
		print(1)
	else:
		print(2)


I = input
for _ in [0] * int(I()):
	I()
	a = {*map(int, I().split())}
	print(bool(a & {x + 1 for x in a}) + 1)


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
for _testcases_ in range(int(input())):
	n = int(input())
	li = sorted(get_list())
	ans = 1
	for i in range(n - 1):
		if li[i] + 1 == li[i + 1]:
			ans = 2
	print(ans)


q = int(input())
while q:
	q -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	check = 0
	for i in range(n - 1):
		if l[i] == l[i + 1] - 1:
			check = 1
			break
	if check:
		print(2)
	else:
		print(1)


from sys import stdin, stdout
for i in stdin:
	q = int(i)
	break
while q:
	k = 0
	for i in stdin:
		asdfsdgsdgsdgsdsdg = int(i)
		break
	for i in stdin:
		N = list(map(int, i.strip().split()))
		break
	N.sort()
	for i in range(len(N) - 1):
		if N[i + 1] - N[i] <= 1:
			stdout.write('2\n')
			k = 1
			break
	if not k:
		stdout.write('1\n')
	q -= 1


for _ in '0' * int(input()):
	(n, r) = (int(input()), 1)
	ls = sorted(map(int, input().split()))
	for i in range(n - 1):
		if ls[i + 1] - ls[i] == 1:
			r = 2
			break
	print(r)


for _ in range(int(input())):
	n = int(input())
	students = map(int, input().split())
	students = sorted(students)
	groups = 1
	for i in range(1, len(students)):
		if students[i] - students[i - 1] <= 1:
			groups += 1
			break
	print(groups)


q = int(input())
a = []
for i in range(q):
	input()
	a += [input().split()]

def div(a):
	if len(a) == 1:
		return 1
	for j in range(len(a)):
		for k in range(len(a)):
			if abs(int(a[j]) - int(a[k])) == 1:
				return 2
	return 1
for s in range(len(a)):
	print(div(a[s]))


q = int(input())
while q > 0:
	q -= 1
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	o = 0
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] == 1:
			o = 1
	print(o + 1)


N = input()
N = int(N)
for i in range(0, N):
	n = input()
	n = int(n)
	a = input().split()
	b = []
	for i in a:
		b.append(int(i))
	b.sort()
	count = 1
	diff = 1
	for i in range(0, len(b) - 1):
		if b[i + 1] - b[i] == 1:
			count = 2
			break
	print(count)


def solve(arr, n):
	j = 1
	if n == 1:
		return 1
	while j < n:
		if arr[j] - arr[j - 1] == 1:
			return 2
		j += 1
	return 1
t = int(input())
for _ in range(t):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	print(solve(arr, n))


from sys import stdin, stdout
q = int(input())
answers = []
for _ in range(q):
	n = int(input())
	nums = list(map(int, stdin.readline().strip().split()))
	d = dict()
	for i in nums:
		d[i] = 0
	ans = 1
	for i in nums:
		if i + 1 in d:
			ans = 2
			break
	answers.append(ans)
print(*answers, sep='\n')


t = int(input())
for _ in range(t):
	q = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	for i in range(1, q):
		if l[i] - l[i - 1] <= 1:
			ans += 1
	if ans == 0:
		print(1)
	else:
		print(2)


q = int(input())
lista = []
flag = 0
for i in range(q):
	n = int(input())
	a = input().split(' ')
	for j in range(n):
		lista.append(int(a[j]))
	lista.sort()
	for k in range(n - 1):
		if lista[k + 1] - lista[k] <= 1:
			print(2)
			flag = 1
			break
	if flag == 0:
		print(1)
	lista = []
	flag = 0


for _ in range(int(input())):
	input()
	l = [int(i) for i in input().split()]
	l.sort()
	ds = []
	for i in range(1, len(l)):
		ds.append(l[i] - l[i - 1])
	if ds.count(1):
		print(2)
	else:
		print(1)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = True
	for i in range(n):
		for j in range(i):
			ans &= abs(l[i] - l[j]) != 1
	print(2 - ans)


for x in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	m.sort()
	r = '1'
	for i in range(1, n):
		if m[i] - m[i - 1] == 1:
			r = '2'
			break
	print(r)


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	if n == 1:
		print(1)
		continue
	for i in range(1, n):
		if abs(A[i - 1] - A[i]) == 1:
			print(2)
			break
		if i == n - 1:
			print(1)
			break


n = int(input())
for _ in range(n):
	x = int(input())
	l = list(map(int, input().split()))
	if x != len(set(l)):
		print(2)
		continue
	l = sorted(l)
	c = 0
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) <= 1:
			c += 1
			break
	if c == 0:
		print(1)
	else:
		print(2)


n = int(input())
for i in range(n):
	a = int(input())
	flag = list(map(int, input().split()))
	flag.sort()
	temp = flag[0]
	for j in flag:
		if j - temp == 1:
			print(2)
			break
		temp = j
		if temp == flag[len(flag) - 1]:
			print(1)


q = int(input())
for i in range(q):
	n = int(input())
	inp = list(map(int, input().split()))
	inp.sort()
	flag = 0
	for k in range(1, len(inp)):
		if inp[k] - inp[k - 1] == 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	sol = 1
	for i in range(n):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) == 1:
				sol = 2
				break
		if sol == 2:
			break
	print(sol)


for _ in range(int(input())):
	n = int(input())
	lst = sorted(map(int, input().split()))
	for i in range(1, n):
		if lst[i] - 1 == lst[i - 1]:
			print(2)
			lst.clear()
			break
	if lst:
		print(1)


import sys
input = sys.stdin.readline
q = int(input())
for testcases in range(q):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	flag = 0
	for i in range(n - 1):
		if A[i] == A[i + 1] - 1:
			flag = 1
	if flag:
		print(2)
	else:
		print(1)


def Solve(data):
	if len(data) <= 1:
		return len(data)
	num = 0
	for x in range(1, len(data)):
		if data[x] - data[x - 1] == 1:
			num += 1
	if num == 0:
		return 1
	else:
		return 2
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	data = [int(x) for x in input().split()]
	data.sort()
	print(Solve(data))


t = int(input())
for i in range(t):
	x = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = False
	for k in range(len(l) - 1):
		if l[k + 1] - l[k] == 1:
			flag = True
			break
	if flag:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	found = 0
	for i in a:
		if not d.get(i):
			d[i] = 1
		if d.get(i - 1) or d.get(i + 1):
			found = 1
			break
	if found:
		print(2)
	else:
		print(1)


a = int(input())
count = 1
for i in range(a):
	condicion = 0
	b = int(input())
	c = [int(i) for i in input().split()]
	c.sort()
	j = 1
	while j <= len(c) - 1:
		if c[j] - c[j - 1] == 1:
			count = 2
			j = len(c)
		else:
			j += 1
	print(count)
	count = 1


q = int(input())
for _ in range(q):
	n = int(input())
	count = 0
	a = sorted(list(map(int, input().split())))
	for i in range(1, len(a)):
		if abs(a[i] - a[i - 1]) == 1:
			count += 1
			break
	print(2 if count > 0 else 1)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	for i in range(n):
		for j in range(n):
			if a[i] - a[j] == 1:
				c = 1
				break
		if c == 1:
			print(2)
			break
	else:
		print(1)


for i in range(int(input())):
	n = int(input())
	l = sorted(map(int, input().split()))
	c = 0
	for j in range(n - 1):
		if l[j + 1] - l[j] <= 1:
			c += 1
	print(1) if c < 1 else print(2)


import sys

def main():
	for _ in range(int(input())):
		n = int(sys.stdin.readline())
		l = [int(x) for x in sys.stdin.readline().split()]
		k = []
		for i in range(n):
			k.append(l[i] + 1)
		c = 0
		for i in k:
			if i in l:
				c = 1
				break
		if c == 0:
			print(1)
		else:
			print(2)
main()


def main():
	Q = int(input())
	for _ in range(Q):
		N = int(input())
		A = [int(i) for i in input().split()]
		A.sort()
		ans = 1
		for i in range(N - 1):
			if A[i + 1] - A[i] == 1:
				ans += 1
				break
		print(ans)
main()


t = int(input())
for tc in range(t):
	n = int(input())
	ans = 1
	A = [int(item) for item in input().split()]
	A.sort()
	prev = A[0]
	for i in range(1, n):
		if A[i] - prev < 2:
			ans = 2
			break
		prev = A[i]
	print(ans)


for q in range(int(input())):
	n = int(input()) - 1
	a = sorted(list(map(int, input().split())), reverse=True)
	while n:
		if a[n - 1] - a[n] == 1:
			print(2)
			break
		n -= 1
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	s = [int(i) for i in input().split()]
	c = 0
	for i in range(n):
		c += s.count(s[i] + 1)
	if c > 0:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	tab = list(map(int, input().split()))
	tab.sort()
	check = 0
	for i in range(1, n):
		if tab[i] - tab[i - 1] == 1:
			check += 1
	if check == 0:
		print(1)
	else:
		print(2)


q = int(input())
while q > 0:
	q -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	s = 1
	z = 1
	i = 0
	while i < n - 1:
		if a[i] - a[i + 1] == -1:
			z = 2
		s = max(z, s)
		i += 1
		z = 1
	print(s)


N = int(input())
Results = [1] * N
for loop in range(N):
	n = int(input())
	List = list(map(int, input().split()))
	List.sort()
	for i in range(1, n):
		if List[i] - List[i - 1] == 1:
			Results[loop] = 2
			i = n - 2
	del List[:]
for loop in range(N):
	print(Results[loop])


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	answer = 1
	p = a[0]
	for j in range(1, n):
		if a[j] - 1 == a[j - 1]:
			answer = 2
			break
	print(answer)


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	cnt = 1
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) == 1:
			cnt = 2
	print(cnt)
	t -= 1


q = int(input())
for t in range(q):
	n = int(input())
	l = [int(i) for i in input().split(' ')]
	l.sort()
	flag = True
	for i in range(1, len(l)):
		if l[i] - l[i - 1] == 1:
			flag = False
			break
	if flag:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	dl = False
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			print(2)
			dl = True
			break
	if not dl:
		print(1)


for _ in range(int(input())):
	i1 = int(input())
	x = list(map(int, input().split()))
	x.sort()
	ab = 'no'
	for m in range(1, i1):
		if abs(x[m] - x[m - 1]) == 1:
			print(2)
			ab = 'yes'
			break
	if ab == 'no':
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	if n == 1:
		print(1)
	else:
		p = a[0]
		for aa in a[1:]:
			if aa - p == 1:
				print(2)
				break
			p = aa
		else:
			print(1)


from sys import stdin
import math
from collections import defaultdict
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	a.sort()
	flag = False
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			flag = True
			break
	print('2' if flag else '1')


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	flag = 0
	for j in range(n):
		for k in range(n):
			if abs(l[j] - l[k]) == 1:
				flag = 1
				break
	if flag == 1:
		print(2)
	else:
		print(1)


ll = []
n = int(input())
for x in range(n):
	k = int(input())
	l = list(map(int, input().split()))
	ll.append(l)
for x in ll:
	x.sort()
	r = 1
	for i in range(len(x) - 1):
		if x[i + 1] - x[i] == 1:
			r = 2
			break
	print(r)


q = int(input())
for _ in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	ans = 1
	for i in range(1, n):
		if arr[i - 1] + 1 == arr[i]:
			ans = 2
	print(ans)


import sys
input = sys.stdin.readline
for nt in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = 0
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			flag = 1
			break
	if flag:
		print(2)
	else:
		print(1)


for i in range(int(input())):
	now = int(input())
	work = sorted(map(lambda x: int(x), input().split()))
	if len(work) == 1:
		print(1)
	else:
		count = 1
		for elem in work:
			for elems in work:
				if abs(elem - elems) == 1:
					count += 1
		if count >= 2:
			print(2)
		else:
			print(1)


import sys
q = int(sys.stdin.readline().strip())

def solve(a, n):
	used = [0] * n
	a.sort()
	commands_count = 0
	for i in range(n):
		prev_ch = -111
		ch_in_command = 0
		for j in range(i, n):
			if used[j] == 0 and abs(a[j] - prev_ch) > 1:
				prev_ch = a[j]
				used[j] = 1
				ch_in_command += 1
		if ch_in_command > 0:
			commands_count += 1
	print(commands_count)
for _ in range(q):
	n = int(sys.stdin.readline().strip())
	a = list(map(int, sys.stdin.readline().strip().split()))
	solve(a, n)


q = int(input())
for Q in range(q):
	n = int(input())
	x = input()
	a = []
	a = x.split(' ')
	for i in range(n):
		a[i] = int(a[i])
	a.sort()
	flag = False
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			flag = True
	if flag:
		print(2)
	else:
		print(1)


from collections import Counter
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	a = [int(x) for x in input().strip().split(' ')]
	if n == 1:
		print(1)
	else:
		c = Counter()
		for i in a:
			c[i] = 1
		k = 0
		for i in range(n):
			if c[a[i] - 1] or c[a[i] + 1]:
				k = 1
				print(2)
				break
		if k == 0:
			print(1)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(1)
		continue
	l.sort()
	flag = False
	for i in range(0, n):
		for j in range(i + 1, n):
			if abs(l[i] - l[j]) == 1:
				flag = True
				break
			elif abs(l[i] - l[j]) > 1:
				break
		if flag:
			break
	if flag:
		print(2)
	else:
		print(1)


import math
q = int(input())
for i in range(q):
	num = []
	n = int(input())
	ans = 1
	a = input()
	for x in a.split():
		num.append(int(x))
	num.sort()
	for k in range(n - 1):
		if num[k] + 1 == num[k + 1]:
			ans = 2
	print(str(ans))


q = int(input())
out = []
for _ in range(q):
	n = int(input())
	v = sorted(map(int, input().split()))
	o = 1
	for i in range(1, n):
		if v[i] - v[i - 1] == 1:
			o = 2
			break
	out.append(o)
print('\n'.join(map(str, out)))


n = int(input())
l = []
for i in range(n):
	m = int(input())
	d = input().split()
	d = [int(i) for i in d]
	l += [d]
for i in l:
	bcp = False
	s = []
	i.sort()
	for j in range(1, len(i)):
		if i[j] - i[j - 1] == 1:
			bcp = True
			break
	if bcp:
		print(2)
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	flag = 0
	for i in range(n - 1):
		if s[i + 1] - s[i] == 1:
			flag = 1
	if flag:
		print(2)
	else:
		print(1)


n = int(input())
while n:
	m = int(input())
	nums = input().split()
	nums = list(map(int, nums))
	nums.sort()
	len_ = len(nums)
	ans = 1
	for i in range(0, len_ - 1):
		if nums[i] == nums[i + 1] - 1:
			ans = 2
			break
	print(ans)
	n -= 1


def main():
	n = int(input())
	a = [int(s) for s in input().split()]
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) == 1:
			return 2
	return 1
t = int(input())
for i in range(t):
	print(main())


tests = int(input())
for te in range(tests):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	flag = 0
	for i in range(1, n):
		if arr[i] - arr[i - 1] == 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


q = int(input())
for j in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	t = [[]]
	for i in range(0, n):
		c = 0
		for k in range(0, len(t)):
			if l[i] - 1 not in t[k] and l[i] + 1 not in t[k]:
				t[k].append(l[i])
				c = 1
				break
		if c == 0:
			t.append([l[i]])
	print(len(t))


def solve():
	n = int(input())
	x = sorted([int(i) for i in input().split()])
	ok = True
	for i in range(n - 1):
		if x[i + 1] - x[i] == 1:
			ok = False
	if ok:
		print(1)
	else:
		print(2)
q = int(input())
for _ in range(q):
	solve()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	n = int(input())
	vals = list(map(int, input().split()))
	vals.sort()
	found = False
	for s in range(1, n):
		gap = vals[s] - vals[s - 1]
		if gap == 1:
			found = True
			break
	if found == False:
		print(1)
	else:
		print(2)


n = int(input())
for queries in range(n):
	students = int(input())
	skill = list(map(int, input().split()))
	count = 0
	for s in range(students - 1):
		skill.sort()
		if skill[s] == skill[s + 1] - 1:
			count += 1
	if count >= 1:
		print(2)
	else:
		print(1)


n = int(input())
for i in range(n):
	m = int(input())
	l = list(map(int, input().split()))
	p = []
	s = []
	for i in range(m):
		s.append(l.count(l[i]))
		c = 0
		for j in range(m):
			if i != j:
				if abs(l[i] - l[j]) <= 1:
					c += 1
		p.append(c)
	r = max(s)
	if max(p) == 0:
		print(1 + r - 1)
	if max(p) > 0:
		print(2 + r - 1)


q = int(input())
teams = []
while q is not 0:
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	s = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) <= 1:
				if len(a[i:j]) > s:
					s += 1
			else:
				break
	teams.append(s + 1)
	q -= 1
for i in teams:
	print(i)


from math import ceil, sqrt, floor, sqrt
import collections
from typing import List
t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	s = set()
	res = 1
	for v in A:
		if v - 1 in s or v + 1 in s:
			res = 2
			break
		s.add(v)
	print(res)


q = int(input())
for i in range(q):
	n = int(input())
	inp = input()
	inp_arr = inp.split(' ')
	inp_arr = [int(j) for j in inp_arr]
	inp_arr.sort()
	flag = False
	for j in range(n - 1):
		if inp_arr[j] == inp_arr[j + 1] - 1:
			flag = True
			break
	if flag == True:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = input()
	a = list(map(int, input().split()))
	s = sorted(a)
	l = len(a)
	cnt = 0
	for i in range(l - 1):
		if s[i + 1] - s[i] == 1:
			cnt += 1
	if cnt == 0:
		print('1')
	else:
		print('2')


n = int(input())
for i in range(0, n):
	m = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	t = 1
	for i in range(0, len(l) - 1):
		if l[i] + 1 == l[i + 1]:
			t = 2
			break
	print(t)


def main():
	q = int(input())
	for x in range(q):
		nb = int(input())
		tab = list(map(int, input().split()))
		tab.sort()
		nba = 1
		for y in range(nb - 1):
			if abs(tab[y] - tab[y + 1]) == 1:
				nba = 2
		print(nba)
main()


for _ in range(int(input())):
	input()
	a = set()
	f = 0
	for i in input().split():
		if int(i) - 1 in a or int(i) + 1 in a:
			f = 1
			break
		else:
			a.add(int(i))
	print(2) if f == 1 else print(1)


import math
x = list(map(int, input().split()))
q = []
n = []
for i in range(0, x[0]):
	n.append(int(input()))
	q.append(list(map(int, input().split())))
for i in range(0, x[0]):
	flag = 0
	q[i].sort()
	if len(q[i]) > 1:
		for j in range(0, len(q[i]) - 1):
			if q[i][j] - q[i][j + 1] == -1 or q[i][j] - q[i][j + 1] == +1:
				flag = 1
	if flag == 1:
		print(2)
	else:
		print(1)


num_queries = int(input())
for _ in range(num_queries):
	_ = int(input())
	skills = sorted(set(map(int, input().split())))
	for (i, skill) in enumerate(skills[:-1]):
		if skill + 1 == skills[i + 1]:
			print(2)
			break
	else:
		print(1)


n = int(input())
for _ in range(n):
	k = int(input())
	a = list(map(int, input().split()))
	a.sort()
	d = 1
	for i in range(1, k):
		if a[i] == a[i - 1] + 1:
			d = 2
	print(d)


n = int(input())
res = []
for _ in range(n):
	q = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	b = True
	for i in range(0, q - 1):
		if abs(a[i + 1] - a[i]) == 1:
			b = False
			break
	res.append(1 if b else 2)
print(*res, sep='\n')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	flag = 0
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) <= 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	a_array = sorted([int(x) for x in input().split()])
	team = 0
	for j in range(n - 1):
		if abs(a_array[j] - a_array[j + 1]) == 1:
			print(2 + n - len(set(a_array)))
			break
	else:
		print(1 + n - len(set(a_array)))


for i in range(int(input())):
	length = int(input())
	a = input().split()
	for i in range(len(a)):
		a[i] = int(a[i])
	a.sort()
	flag = '1'
	if len(a) > 1:
		for i in range(len(a) - 1):
			if a[i] + 1 == a[i + 1]:
				flag = '2'
				break
	print(flag)


def main():
	q = int(input())
	for i in range(q):
		n = int(input())
		A = []
		x = input()
		A = x.split()
		for j in range(n):
			A[j] = int(A[j])
		A.sort()
		X = 1
		for j in range(1, n):
			if abs(A[j] - A[j - 1]) == 1:
				X += 1
				break
		print(X)
main()


t = int(input())
for i in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	s = 1
	for j in range(n):
		for k in range(j + 1, n):
			q = abs(x[k] - x[j])
			if q == 1:
				s = 2
	print(s)


Q = int(input())
for q in range(Q):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	fl = 0
	for a in range(len(A) - 1):
		if A[a] == A[a + 1] - 1:
			print(2)
			fl = 1
			break
	if fl == 0:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	flag = False
	for i in range(len(arr) - 1):
		if arr[i + 1] - arr[i] == 1:
			flag = True
	if flag:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	a = map(int, input().split())
	a = sorted(a)
	continuos = False
	for i in range(len(a) - 1):
		if a[i] - a[i + 1] == -1:
			continuos = True
			break
	if continuos:
		print(2)
	else:
		print(1)


t = input()
for _ in range(0, int(t)):
	l = int(input())
	ss = input().split(' ')
	sss = []
	for r in range(0, len(ss)):
		sss.append(int(ss[r]))
	s = sorted(sss)
	tt = 1
	for q in range(0, l - 1):
		if int(s[q]) + 1 == int(s[q + 1]):
			tt = 2
	print(tt)


for i in range(int(input())):
	n = int(input())
	numbers = [int(y) for y in input().split()]
	numbers.sort()
	flag = 0
	for i in range(len(numbers) - 1):
		if numbers[i + 1] - numbers[i] <= 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	if len(l) < 2:
		print(len(l))
	else:
		test = True
		for i in range(n - 1):
			for j in range(i, n - 1):
				if abs(l[i] - l[j + 1]) == 1:
					test = False
		if test == True:
			print(1)
		else:
			print(2)


q = int(input())
x = []
for i in range(q):
	a = input()
	y = input().split()
	y = [int(i) for i in y]
	x.append(y)
for i in x:
	for j in range(len(i)):
		if i[j] + 1 in i:
			print(2)
			break
	else:
		print(1)


q = int(input())
while q > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	flag = 0
	amap = {}
	for x in a:
		amap[x] = 1
	for x in a:
		if x - 1 in amap or x + 1 in amap:
			flag = 1
	if flag == 1:
		print(2)
	else:
		print(1)
	q -= 1


q = int(input())
res = []
for i in range(q):
	n = int(input())
	abil = list(sorted(map(int, input().split())))
	teams = [[abil[0]]]
	for j in range(1, n):
		check = True
		for k in range(len(teams)):
			if abil[j] - 1 not in teams[k]:
				teams[k].append(abil[j])
				check = False
				break
		if check:
			teams.append([abil[j]])
	res.append(str(len(teams)))
print('\n'.join(res))


from sys import stdin, stdout
q = int(stdin.readline().strip())
for _ in range(q):
	n = int(stdin.readline().strip())
	arr = list(map(int, stdin.readline().split()))
	arr.sort()
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			pass
		else:
			print(2)
			break
	else:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 1
	for j in range(1, n):
		if abs(a[j] - a[j - 1]) == 1:
			count += 1
			break
	print(count)


def skillteam(n, l):
	l.sort()
	for i in range(0, len(l) - 1):
		if abs(l[i] - l[i + 1]) == 1:
			return 2
	return 1
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(skillteam(n, l))


for i in range(int(input())):
	N = int(input())
	flag = 0
	A = list(map(int, input().split()))
	A.sort()
	for j in range(1, N):
		if A[j] - A[j - 1] == 1:
			print(2)
			flag = 1
			break
	if flag == 0:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	answer = 1
	for i in range(n - 1):
		if abs(l[i] - l[i + 1]) == 1:
			answer = 2
			break
	print(answer)


def team(ele, arr, ind):
	for i in range(ind, len(arr)):
		if vis[i] != 1 and abs(ele - arr[i]) != 1:
			vis[i] = 1
			ele = arr[i]
t = int(input())
for _ in range(0, t):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	vis = [0] * n
	cnt = 0
	a.sort()
	for (ind, ele) in enumerate(a):
		if vis[ind] != 1:
			team(ele, a, ind + 1)
			cnt += 1
	print(cnt)


from collections import defaultdict as dc
from collections import deque as dq
from bisect import bisect_left, bisect_right, insort_left
import sys
import math
mod = 10 ** 9 + 7

def bs(a, x):
	i = bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return len(a)

def inp():
	p = sys.stdin.readline()
	return p

def line():
	p = list(map(int, inp().split()))
	return p

def bs(a, b):
	l = a
	r = b + 1
	x = b
	ans = 0
	while l < r:
		mid = (l + r) // 2
		if x | mid > ans:
			ans = x | mid
			l = mid + 1
		else:
			r = mid
	return ans

def bsl(a, b):
	l = a
	r = b + 1
	x = b
	ans = 0
	while l < r:
		mid = (l + r) // 2
		if x | mid > ans:
			ans = x | mid
			r = mid - 1
		else:
			l = mid + 1
	return ans
for _ in range(int(input())):
	n = int(inp())
	a = line()
	a.sort()
	k = 0
	for i in range(1, n):
		if a[i] - a[i - 1] <= 1:
			k = 1
			break
	if k == 1:
		print(2)
	else:
		print(1)


def do():
	N = int(input())
	for i in range(N):
		count = 0
		B = int(input())
		ch = input()
		ch = [int(i) for i in ch.split(' ')]
		ch.sort()
		if len(ch) == 1:
			print(1)
			continue
		for i in range(len(ch) - 1):
			if ch[i + 1] - ch[i] == 1:
				count += 1
		if count == 0:
			print(1)
			continue
		if count >= 1:
			print(2)
do()


import sys, math, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = int(input())
for _ in range(n):
	k = I()
	l = L()
	l.sort()
	flag = 1
	for i in range(1, k):
		if l[i] - l[i - 1] == 1:
			print(2)
			flag = 0
			break
	if flag:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	d = 0
	res = True
	for j in range(1, n):
		d = a[j] - a[j - 1]
		if d == 1:
			res = False
			break
	if res:
		print(1)
	else:
		print(2)


q = int(input())
for I in range(q):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	one = 0
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) == 1:
			one = 1
			break
	if one:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	for i in arr:
		if i + 1 in arr or i - 1 in arr or arr.count(i) > 1:
			flag = True
			break
		else:
			flag = False
	if flag:
		print('2')
	else:
		print('1')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ok = True
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			ok = False
			break
	if ok:
		print(1)
	else:
		print(2)


for q in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	d = {}
	res = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			res = 2
			break
	print(res)


Q = int(input())
for _ in range(Q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = 1
	c1 = a[0]
	for i in range(1, len(a)):
		c2 = a[i]
		diff = abs(c2 - c1)
		if diff == 1:
			flag = 0
			break
		c1 = c2
	if flag:
		print('1')
	else:
		print('2')


q = int(input())
for _ in range(q):
	n = int(input())
	dat = list(map(int, input().split()))
	dat.sort()
	c = True
	for i in range(1, n):
		if dat[i] - dat[i - 1] <= 1:
			c = False
	print('1' if c else '2')


import sys, atexit
from io import BytesIO
inp = BytesIO(sys.stdin.buffer.read())
input = lambda : inp.readline().decode('ascii')
buf = BytesIO()
atexit.register(lambda : sys.__stdout__.buffer.write(buf.getvalue()))
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			print(2)
			break
	else:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	al = list(map(int, input().split()))
	al.sort()
	dl = [al[i] - al[i - 1] for i in range(1, n)]
	print(2 if 1 in dl else 1)


import sys
import itertools
import math
import collections
from collections import Counter

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = prime[1] = False
	r = [p for p in range(n + 1) if prime[p]]
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)
t = ii()
for i in range(t):
	n = ii()
	d = sorted(li())
	f = True
	for i in range(1, n):
		if d[i] - d[i - 1] == 1:
			print(2)
			f = False
			break
	if f:
		print(1)


q = int(input())
for i in range(q):
	w = int(input())
	e = sorted(list(map(int, input().split())))
	ans = 1
	for j in range(w - 1):
		if e[j + 1] - 1 == e[j]:
			ans = 2
			break
	print(ans)


q = int(input())
all = []

def check(mass):
	mass.sort()
	for i in range(len(mass) - 1):
		if mass[i + 1] - mass[i] == 1:
			return True
	return False
for i in range(q):
	n = int(input())
	mass = input().split()
	for i in range(len(mass)):
		mass[i] = int(mass[i])
	if check(mass):
		all.append(2)
	else:
		all.append(1)
for i in all:
	print(i)


r = []
m = int(input())
for i in ' ' * m:
	n = int(input())
	(*l,) = map(int, input().split())
	l.sort()
	c = 1
	for j in range(n):
		for k in range(j + 1, n):
			if abs(l[j] - l[k]) == 1:
				c += 1
				break
		if c > 1:
			break
	r += [c]
for i in r:
	print(i)


R = lambda : map(int, input().split())
(q,) = R()
for _ in [0] * q:
	R()
	a = sorted(R())
	print(3 - min((y - x for (x, y) in zip([a[0] - 2] + a, a))))


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = 1
	for i in range(n - 1):
		if arr[i + 1] == arr[i] + 1:
			ans = 2
			break
	print(ans)


for _ in [*open(0)][2::2]:
	k = 1
	a = [*map(int, _.split())]
	for i in a:
		for j in a:
			if abs(i - j) == 1:
				k = 2
	print(k)


t = int(input())
for i in range(t):
	flag = 0
	n = int(input())
	a = sorted(map(int, input().split()))
	for j in range(n - 1):
		if a[j + 1] - a[j] == 1:
			flag = 1
			print(2)
			break
	if flag == 0:
		print(1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 1
	last = -1000
	for (i, x) in enumerate(sorted(arr)):
		if x == last + 1:
			ans = 2
		last = x
	print(ans)


q = int(input())
while q > 0:
	n = int(input())
	a = [int(i) for i in input().split()]
	team = 0
	a.sort()
	ans = 1
	for i in range(0, n - 1):
		if a[i + 1] - a[i] == 1:
			ans = 2
			break
		else:
			ans = 1
	print(ans)
	q -= 1


t = int(input())
for j in range(0, t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	s = 1
	for x in range(0, n - 1):
		if a[x + 1] - a[x] == 1:
			s = 2
			break
	print(s)


from sys import stdin

def main():
	l = stdin.read().splitlines()[2::2]
	for (i, s) in enumerate(l):
		t = sorted(map(int, s.split()))
		l[i] = '12'[any((a == b - 1 for (a, b) in zip(t, t[1:])))]
	print('\n'.join(l))
main()


for _ in range(int(input())):
	input()
	final = []
	c = 0
	arr = list(map(int, input().split()))
	arr1 = []
	for i in arr:
		if i + 1 in arr:
			arr1.append(i + 1)
			arr.remove(i + 1)
	if arr1 == []:
		print(1)
	else:
		print(2)


def is_two_team(lst):
	for j in range(len(lst) - 1):
		if lst[j] + 1 == lst[j + 1]:
			return True
	return False
n = int(input())
for i in range(n):
	input()
	lst = list(map(int, input().split()))
	lst.sort()
	if is_two_team(lst):
		print(2)
	else:
		print(1)


q = int(input())
s = []
for i in range(q):
	n = int(input())
	l = [int(i) for i in input().split()]
	test = 0
	l.sort()
	for j in range(len(l) - 1):
		if abs(l[j] - l[j + 1]) == 1:
			test = 1
			break
	if test == 0:
		s.append(1)
	else:
		s.append(2)
for i in s:
	print(i)


q = int(input())
for _ in range(q):
	n = int(input())
	b = False
	arr = input().split()
	for i in range(len(arr)):
		for j in range(i + 1, len(arr)):
			if abs(int(arr[i]) - int(arr[j])) == 1:
				b = True
	if b:
		print(2)
	else:
		print(1)


T = int(input())
for t in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	numbers = [0] * 101
	for a in arr:
		numbers[a] += 1
	a = [-1, 0]
	b = [-1, 0]
	for (index, nu) in enumerate(numbers):
		if not nu:
			continue
		if abs(a[0] - index) > 1:
			a = [index, a[1] + 1]
		else:
			b = [index, b[1] + 1]
	if a[1] > 0 and b[1] > 0:
		print(2)
	else:
		print(1)


n = int(input())
for i in range(n):
	p = 0
	y = int(input())
	l = sorted(list(map(int, input().split())))
	for j in range(len(l) - 1):
		s = l[j + 1] - l[j]
		if s == 1:
			p = 1
	if p == 0:
		print('1')
	else:
		print('2')


test_num = int(input())
for num in range(test_num):
	res = 1
	nothing = input()
	stud = input().split(' ')
	for x in stud:
		if str(int(x) + 1) in stud:
			res += 1
			break
	print(res)


def f(l, n):
	l.sort()
	for i in range(n - 1):
		if abs(l[i] - l[i + 1]) == 1:
			return 2
	return 1
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(f(l, n))


def func(a):
	a.sort()
	for (i, e) in enumerate(a):
		if e - a[i - 1] == 1:
			return 2
	return 1
n = int(input())
for _ in range(n):
	_ = input()
	a = list(map(int, input().split(' ')))
	print(func(a))


q = int(input())
for i in range(q):
	n = int(input())
	arr = [int(arr) for arr in input().split(' ')]
	isone = False
	for i in range(n):
		for j in range(i, n):
			if abs(arr[i] - arr[j]) == 1:
				isone = True
				break
	if isone == True:
		print(2)
	elif isone == False:
		print(1)


from fractions import gcd
from datetime import date, timedelta
from heapq import *
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7

def main():
	q = int(input())
	for i in range(q):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		ans = 1
		for i in range(n - 1):
			if abs(a[i] - a[i + 1]) == 1:
				ans += 1
				break
		print(ans)
main()


t = int(input())
for t in range(t):
	p = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	i = 0
	while len(lst) > 0:
		j = 1
		q = lst[0] + 1
		while j < len(lst):
			if q == lst[j]:
				j += 1
			else:
				q = lst[j] + 1
				lst.remove(lst[j])
		i += 1
		lst.remove(lst[0])
	print(i)


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	l = [0 for i in range(101)]
	for i in A:
		l[i] = 1
	flag = 1
	for i in range(1, 101):
		if l[i] == 1 and l[i - 1] == 1:
			flag = 2
			break
	print(flag)


q = int(input())
for i in range(q):
	n = int(input())
	team = 1
	students = [int(x) for x in input().split()]
	students.sort()
	for k in range(n - 1):
		if students[k + 1] - students[k] == 1:
			team = 2
			print(team)
			break
	if team != 2:
		print(team)


from sys import stdin
n = int(stdin.readline())
for _ in range(n):
	c = [False] * 101
	stdin.readline()
	nums = list(map(int, stdin.readline().rstrip().split(' ')))
	count = 0
	for num in nums:
		c[num] = True
	for num in nums:
		if c[num - 1]:
			count += 1
	if count == 0:
		print(1)
	else:
		print(2)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l[:])
	l.sort()
	f1 = False
	mx = 0
	if n == 1:
		print('1')
	else:
		for i in range(1, len(l)):
			if l[i] - l[i - 1] <= 1:
				f1 = True
		if f1 and len(l) == len(s):
			print('2')
		elif f1:
			i = 0
			while i < len(l):
				m = l.count(l[i])
				i += m
				if m > mx:
					mx = m
			if mx > 1:
				print(mx)
		else:
			print('1')


for q in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for i in range(0, n - 1):
		if abs(a[i] - a[i + 1]) == 1:
			ans = 2
			break
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = 0
	for j in range(1, n):
		if a[j] - a[j - 1] == 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


t = int(input())
for l in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	for i in range(len(arr)):
		ans.append(max(arr.count(arr[i] + 1), arr.count(arr[i] - 1)))
	print(max(ans) + 1)


N = []
A = []
t = int(input())
for i in range(t):
	N.append(int(input()))
	a = list(map(int, input().split()))
	A.append(a)
for i in range(t):
	a = A[i]
	a.sort()
	ans = 1
	for j in range(N[i] - 1):
		if a[j] == a[j + 1] - 1:
			ans = 2
			break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	f = list(map(int, input().split()))
	res = 1
	f.sort()
	for j in range(1, n):
		if f[j] - f[j - 1] == 1:
			res = 2
			break
	print(res)


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
ls = lambda : list(input().strip())
from collections import defaultdict as df
import heapq
infinite = float('inf')
t = int(input())
for i in range(t):
	n = int(input())
	l = RI()
	l.sort()
	f = 0
	for j in range(1, len(l)):
		if l[j] - l[j - 1] == 1:
			f = 1
			break
	if f == 1:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	input()
	data = sorted(map(int, input().split()))
	found = False
	for i in range(1, len(data)):
		if data[i] == data[i - 1] + 1:
			found = True
			break
	print(int(found) + 1)


o = int(input())
for i in range(o):
	k = int(input())
	l = [int(x) for x in input().split(' ')]
	if k == 1:
		print('1')
	else:
		count = 0
		for i in range(k - 1):
			for j in range(i + 1, k):
				if abs(l[i] - l[j]) <= 1:
					count = count + 1
		if count == 0:
			print('1')
		else:
			print('2')


t = int(input())
for z in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 0
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			count = 1
	print(count + 1)


q = int(input())
while q > 0:
	q -= 1
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	ans = 1
	for i in range(n - 1):
		if arr[i + 1] - arr[i] <= 1:
			ans = 2
			break
	print(ans)


import sys
from collections import deque, defaultdict
from fractions import gcd
from math import ceil

def N():
	return int(sys.stdin.readline())

def NK():
	return map(int, sys.stdin.readline().split())

def LS_I():
	return [int(x) for x in sys.stdin.readline().split()]

def LS_S():
	return list(input())

def main():
	q = N()
	for _ in range(q):
		n = N()
		ls = LS_I()
		ls = sorted(ls)
		flg = False
		for i in range(n - 1):
			if ls[i] == ls[i + 1] - 1:
				flg = True
			else:
				pass
		if flg:
			print(2)
		else:
			print(1)
main()


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	one = True
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			one = False
			break
	if one:
		print(1)
	else:
		print(2)


q = int(input())
for it in range(q):
	n = int(input())
	A = list(map(int, input().split()))
	A = sorted(A)
	Flag = 1
	for i in range(1, n):
		if A[i] == A[i - 1] + 1:
			Flag = 2
			break
	print(Flag)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	c = 1
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			c += 1
			if c == 2:
				break
	print(c)


t = int(input())
while t != 0:
	a = int(input())
	b = list(map(int, input().split()))
	k = 0
	for i in b:
		if i + 1 in b:
			k = 1
			break
		elif i - 1 in b:
			k = 1
			break
	if k == 1:
		print(2)
	else:
		print(1)
	t -= 1


def amount_commands():
	arr.sort()
	for i in range(1, n):
		if arr[i] - arr[i - 1] == 1:
			return 2
	return 1
q = int(input())
for _ in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	print(amount_commands())


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(a) == 1:
		print(1)
		continue
	a.sort()
	k = 1
	for i in range(1, len(a)):
		if a[i] - a[i - 1] == 1:
			k = 2
			break
	print(k)


def solve():
	n = int(input())
	numeros = list(map(int, input().split()))
	numeros.sort()
	for i in range(0, len(numeros) - 1):
		if numeros[i + 1] - numeros[i] <= 1:
			return 2
	return 1
a = int(input())
for i in range(0, a):
	print(solve())


for _ in range(int(input())):
	flag = 0
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	mindif = 10 ** 9 + 7
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			None
		else:
			flag = 1
			break
	if flag == 0:
		print(1)
	else:
		print(2)


R = lambda : map(int, input().split())
(q,) = R()
for _ in [0] * q:
	R()
	a = set(R())
	print(bool(a & {x + 1 for x in a}) + 1)


q = int(input())
out = []
for i in range(q):
	n = int(input())
	a = sorted(map(int, input().split()))
	comands = 1
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) == 1:
			comands = 2
	out.append(str(comands))
print('\n'.join(out))


q = int(input())
l = []
for i in range(0, q):
	nq = int(input())
	students = [int(i) for i in input().split()]
	l.append(students)
for i in range(0, q):
	team1 = [l[i][0]]
	team2 = []
	v = True
	for s in l[i]:
		for steam1 in l[i]:
			d = steam1 - s
			if abs(d) == 1:
				v = False
				break
		if v == False:
			break
	if not v:
		print('2')
	if v:
		print('1')


def check(n, lst):
	if n == 1:
		return 1
	k = 0
	for i in range(n):
		if i + 1 < n and lst[i + 1] - 1 == lst[i]:
			k += 1
			break
	if k != 0:
		return 2
	return 1
t = int(input())
for j in range(t):
	m = int(input())
	a = [int(x) for x in input().split()]
	print(check(m, sorted(a)))


req = int(input())

def find_teams():
	members = int(input())
	skills = sorted(list(map(int, input().split())))
	if members == 1:
		return 1
	for i in range(members - 1):
		if skills[i + 1] - skills[i] == 1:
			return 2
	return 1
for _ in range(req):
	print(find_teams())


for t in range(int(input())):
	n = int(input())
	ls = list(map(int, input().split()))
	maxn = max(ls)
	hashm = [0] * (maxn + 2)
	for i in ls:
		hashm[i] = 1
	bol = True
	for i in range(len(ls)):
		if hashm[ls[i] + 1] == 1 or hashm[ls[i] - 1] == 1:
			print('2')
			bol = False
			break
	if bol == True:
		print('1')


num_queries = int(input())
for _ in range(num_queries):
	num_members = input()
	skills = sorted(list(map(int, input().split(' '))))
	adjacent = False
	for skill in skills:
		if skill + 1 in skills:
			adjacent = True
			break
	if adjacent:
		print(2)
	else:
		print(1)


def foo(s):
	s_mod = sorted(s)
	n = len(s_mod)
	i = 0
	while i < n - 1:
		if s_mod[i + 1] - s_mod[i] == 1:
			return 2
		i += 1
	return 1
query = int(input())
for q in range(query):
	l = map(int, input().split())
	arr = input().split(' ')
	s = [int(e) for e in arr]
	print(foo(s))


n = int(input())
c = []
for i in range(n):
	b = []
	x = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for j in range(len(a) - 1):
		if a[j + 1] - a[j] == 1:
			b.append(a[j + 1])
			a[j + 1] = 0
	if b == []:
		c.append(1)
	else:
		c.append(2)
for i in range(n):
	print(c[i])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = False
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			flag = True
	if flag:
		print(2)
	else:
		print(1)


n = int(input())
for i in range(n):
	m = int(input())
	a = [int(i) for i in input().split()]
	a = sorted(a)
	flag = 1
	for j in range(0, len(a) - 1):
		if a[j + 1] - a[j] == 1:
			flag = flag + 1
			break
	print(flag)


q = int(input())
for i in range(q):
	n = int(input())
	A = [int(x) for x in input().split()]
	A.sort()
	res = 0
	temp = 1
	flag = False
	for i in range(1, n):
		if A[i] - A[i - 1] == 1:
			flag = True
	if flag:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	ls = [int(x) for x in input().split()]
	ans = 1
	for i in range(len(ls)):
		for j in range(i + 1, len(ls)):
			if abs(ls[i] - ls[j]) == 1:
				ans = 2
	print(ans)


for q in range(int(input())):
	h = int(input())
	x = list(map(int, input().split()))
	i = 0
	t = 0
	while i < h - 1:
		t = 0
		i = i + 1
		j = 0
		while j <= h - 1:
			if x[i] - x[j] == 1 or x[j] - x[i] == 1:
				t = 1
				print(2)
				break
			j = j + 1
		if t == 1:
			break
	if t == 0:
		print(1)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
	return int(input())

def getList():
	return list(map(int, input().split()))
import math

def solve():
	n = getN()
	nums = getList()
	nums.sort()
	tmp = -1000
	for num in nums:
		if abs(tmp - num) == 1:
			print(2)
			return
		tmp = num
	print(1)
	return

def main():
	q = getN()
	for _ in range(q):
		solve()
main()


q = int(input())
for _ in range(q):
	c = 0
	n = int(input())
	l = list(map(int, input().split()))
	for i in range(n - 1):
		for j in range(i + 1, n):
			if l[i] - l[j] == 1 or l[j] - l[i] == 1:
				c += 1
		if c:
			break
	print([1, 2][c > 0])


lst2 = []
n = int(input())
for i in range(n):
	a = int(input())
	lst1 = list(map(int, input().split()))
	lst1.sort()
	flag = 0
	for i in range(len(lst1) - 1):
		if lst1[i + 1] - lst1[i] == 1:
			flag = 1
			break
	if flag == 0:
		lst2.append(1)
	else:
		lst2.append(2)
for i in lst2:
	print(i)


def count(n, skill):
	if n == 1:
		return 1
	else:
		sebelah = False
		i = 0
		skill.sort()
		while i < n - 1 and (not sebelah):
			if skill[i] - skill[i + 1] == 1 or skill[i] - skill[i + 1] == -1:
				sebelah = True
			i += 1
		if sebelah:
			return 2
		else:
			return 1
q = int(input())
res = ''
for i in range(q):
	n = int(input())
	skill = list(map(int, input().split()))
	res += str(count(n, skill)) + '\n'
print(res.strip())


t = int(input())
for i in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	count = 0
	for j in range(1, n):
		if nums[j] - nums[j - 1] == 1:
			count = count + 1
	if count == 0:
		print('1')
	else:
		print('2')


q = int(input())

def abss(L):
	c = 0
	n = len(L)
	for i in range(n - 1):
		if abs(L[i] - L[i + 1]) == 1:
			c = 1
			break
		else:
			c = 0
	if c == 1:
		return True
	else:
		return False
F = []
for i in range(q):
	n = int(input())
	L = list((int(x) for x in input().split()))
	L.sort()
	if abss(L):
		F.append(2)
	else:
		F.append(1)
for i in F:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = set(map(int, input().split()))
	f = True
	for i in a:
		if i + 1 in a or i - 1 in a:
			print(2)
			f = False
			break
	if f:
		print(1)


test_cases = int(input())

def find_consecutive(my_skill, stds_skills):
	return my_skill + 1 in stds_skills
for i in range(test_cases):
	no_of_stds = int(input())
	stds_skills = list(map(int, input().split(' ')))
	stds_skills.sort()
	if any([find_consecutive(my_skill, stds_skills) for my_skill in stds_skills]):
		print(2)
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	a.sort()
	for j in range(n - 1):
		if abs(a[j] - a[j + 1]) == 1:
			count = count + 1
	if count == 0:
		print('1')
	else:
		print('2')


def sorting(a):
	a.sort()
	t = 0
	m = 0
	while a != [-1] * len(a):
		for i in range(0, len(a)):
			if a[i] == -1:
				continue
			if a[i] - a[t] > 1:
				a[t] = -1
				t = i
		a[t] = -1
		for i in range(len(a)):
			if a[i] != -1:
				t = i
				break
		m += 1
	return m
q = int(input())
answer = []
for i in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	answer.append(sorting(arr))
print(*answer)


q = int(input())
for _ in range(q):
	n = int(input())
	As = sorted(list(map(int, input().split())))
	prev = As[0]
	ans = 1
	for a in As[1:]:
		if a - prev == 1:
			ans = 2
			break
		prev = a
	print(ans)


def main():
	q = int(input())
	while q > 0:
		q = q - 1
		n = int(input())
		a = map(int, input().split())
		a = sorted(a)
		ans = 1
		for i in range(1, n):
			if a[i] - a[i - 1] == 1:
				ans = 2
		print(ans)
while True:
	try:
		main()
	except EOFError:
		break


for _ in range(int(input())):
	input()
	arr = list(map(int, input().split()))
	print(2 if sum(map(lambda x: arr.count(x + 1), arr)) > 0 else 1)


n = int(input())
for x in range(n):
	a = int(input())
	array = list(map(int, input().split()))
	flag = 5
	array.sort()
	for x in range(0, a - 1):
		if array[x + 1] - array[x] == 1:
			flag = 6
			break
	if flag == 6:
		print(2)
	else:
		print(1)


t = int(input())
for z in range(t):
	FLAG = 0
	n = int(input())
	nums = [int(x) for x in input().split()]
	nums.sort()
	for i in range(n - 1):
		if nums[i] == nums[i + 1] - 1:
			FLAG = 1
	if FLAG == 1:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	diff = []
	n = int(input())
	X = [int(x) for x in input().split(' ')]
	X.sort()
	for i in range(1, n):
		diff.append(X[i] - X[i - 1])
	if diff.count(1) == 0:
		print(1)
	else:
		print(2)


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(n - 1):
		if l[i + 1] - l[i] == 1:
			print('2')
			break
	else:
		print('1')


t = int(input())
for q in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	c = 1
	for i in range(n - 1):
		if l[i + 1] - l[i] > 1:
			continue
		else:
			c += 1
			break
	print(c)


from sys import stdin

def solution(t: int) -> None:
	input = stdin.readline
	for i in range(t):
		n = int(input())
		arr = sorted(map(int, input().split()))
		flag = True
		for i in range(n - 1):
			if arr[i + 1] - arr[i] == 1:
				flag = False
				print(2)
				break
		if flag:
			print(1)

def main():
	t = int(input())
	solution(t)
main()


n = int(input())
for i in range(n):
	q = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 1
	for j in range(q - 1):
		if abs(l[j] - l[j + 1]) == 1:
			ans = 2
			break
	print(ans)


case = int(input())
for caseNum in range(0, case):
	n = int(input())
	numList = [int(x) for x in input().split()]
	numList.sort()
	found = False
	for i in range(0, n - 1):
		if abs(numList[i] - numList[i + 1]) == 1:
			found = True
	if found:
		print(2)
	else:
		print(1)


def partition(arr, low, high):
	i = low - 1
	pivot = arr[high]
	for j in range(low, high):
		if arr[j] <= pivot:
			i = i + 1
			(arr[i], arr[j]) = (arr[j], arr[i])
	(arr[i + 1], arr[high]) = (arr[high], arr[i + 1])
	return i + 1

def quickSort(arr, low, high):
	if low < high:
		pi = partition(arr, low, high)
		quickSort(arr, low, pi - 1)
		quickSort(arr, pi + 1, high)
q = int(input())
for i in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	c = 0
	quickSort(arr, 0, n - 1)
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) == 1:
			print(2)
			c = 1
		if c == 1:
			break
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	print(2 if any((a[i] - a[i - 1] == 1 for i in range(1, n))) else 1)


import sys
q = int(sys.stdin.readline())
for _ in range(q):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	judge = True
	for i in range(n):
		for j in range(n):
			if abs(a[i] - a[j]) == 1:
				print(2)
				judge = False
				break
		if judge == False:
			break
	if judge == True:
		print(1)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		a = sorted(a)
		rr.append(IF(any((a[i + 1] - a[i] == 1 for i in range(n - 1))), 2, 1))
	return JA(rr, '\n')
print(main())


q = int(input())
for _ in range(q):
	n = int(input())
	A = [*map(int, input().split())]
	A.sort()
	t = 1
	for i in range(len(A)):
		if i > 0 and A[i] == A[i - 1] + 1:
			t = 2
	print(t)


import sys

def test():
	n = int(input())
	v = [int(x) for x in input().split()]
	v = sorted(v)
	has_close = 0
	for i in range(len(v) - 1):
		if abs(v[i] - v[i + 1]) == 1:
			has_close = 1
	print(has_close + 1)
t = int(input())
for _ in range(t):
	test()


t = int(input())
for k in range(t):
	n = int(input())
	arr = list(map(int, input().split()[:n]))
	arr = sorted(arr)
	count = 0
	for i in range(1, n):
		if arr[i] - arr[i - 1] == 1:
			count += 1
	if count != 0:
		print(2)
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * 100
	a.sort()
	ans = 1
	for j in range(1, n):
		if a[j] == a[j - 1] + 1:
			ans = 2
			break
	print(ans)


for i in range(int(input())):
	n = int(input())
	A = list(map(int, input().split(' ')))
	flag = 1
	A.sort()
	for i in range(1, len(A)):
		if abs(A[i] - A[i - 1]) == 1:
			flag = 0
			break
	print(2) if flag == 0 else print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	a.append(1000)
	ret = 1
	for i in range(n):
		if a[i] + 1 == a[i + 1]:
			ret = 2
			break
	print(ret)


t = int(input())
for _ in range(t):
	y = int(input())
	if y < 2:
		print(1)
		input()
	else:
		x = list(map(int, input().split()))
		i = True
		for a in x:
			if a + 1 in x:
				i = False
				break
		if not i:
			print(2)
		else:
			print(1)


for _ in range(int(input())):
	n = int(input())
	flag = 0
	lis = list(map(int, input().split()))
	lis.sort()
	for i in range(len(lis) - 1):
		if lis[i + 1] == lis[i] + 1:
			flag = 1
	if flag == 1:
		print(2)
	else:
		print(1)


n = int(input())
for i in range(n):
	m = int(input())
	lst = list(map(int, input().split()))
	lst = sorted(lst)
	flag = False
	for j in range(m - 1):
		if abs(lst[j] - lst[j + 1]) == 1:
			flag = True
			break
	if flag:
		print(2)
	else:
		print(1)


g = int(input())
for i in range(g):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	num = 0
	while a != []:
		a1 = []
		last = -1
		for x in a:
			if abs(x - last) <= 1:
				a1.append(last)
			else:
				last = x
		a = a1[:]
		num += 1
	print(num)


queries = int(input())
for q in range(queries):
	n = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	team = 1
	for i in range(1, len(nums)):
		if nums[i] == nums[i - 1] + 1:
			team = 2
			break
	print(team)


k = int(input())
for _ in range(k):
	n = int(input())
	nums = sorted([int(x) for x in input().split()])
	results = []
	for x in nums:
		ok = False
		for (idx, y) in enumerate(results):
			if x > y + 1:
				ok = True
				results[idx] = x
				break
		if not ok:
			results.append(x)
	print(len(results))


t = int(input())
for q in range(0, t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	flag = 0
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			flag = 1
			break
	if flag == 1:
		print('2')
	else:
		print('1')


q = int(input())
for i in range(q):
	n = int(input())
	nl = [int(i) for i in input().split()]
	kek = 1
	for i in nl:
		for j in nl:
			if abs(i - j) == 1:
				kek = 2
				break
		if kek == 2:
			break
	print(kek)


import sys
from bisect import bisect
inp = sys.stdin.readline
ans = ''
for _ in range(int(inp())):
	n = int(inp())
	arr = set(map(int, inp().split()))
	c = 1
	for i in arr:
		if i + 1 in arr:
			c = 2
			break
	ans += str(c) + '\n'
print(ans)


q = int(input())
for _ in range(q):
	n = int(input())
	skills = list(map(int, input().split()))
	teams = 1
	found = False
	skills = sorted(set(skills))
	for i in range(len(skills) - 1):
		if skills[i] + 1 == skills[i + 1]:
			teams += 1
			break
	print(teams)


MAX = pow(10, 5)
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 1
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			ans = 2
			break
	print(ans)


queries = int(input())
for __ in range(queries):
	q = int(input())
	nums = [int(i) for i in input().split()]
	nums.sort()
	u1 = -1
	u2 = -1
	for i in range(q):
		if nums[i] - u1 > 1:
			u1 = nums[i]
		else:
			u2 = nums[i]
	if u2 == -1:
		print(1)
	else:
		print(2)


team = 1
q = int(input())
for x in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	team = 1
	diff = [a[i + 1] - a[i] for i in range(len(a) - 1)]
	for j in diff:
		if j == 1 and len(a) > 1:
			team = 2
			break
		else:
			team = 1
	print(team)


class Main:

	def __init__(self):
		self.n = int(input())
		self.a = [int(x) for x in input().split()]

	def main(self):
		self.a.sort()
		print(2 if any((self.a[i + 1] - self.a[i] == 1 for i in range(self.n - 1))) else 1)
for _ in range(int(input())):
	Main().main()


q = int(input())
for i in range(q):
	n = int(input())
	x = sorted(list(map(int, input().split())))
	if n == 1:
		print(1)
	for j in range(n - 1):
		if abs(x[j] - x[j + 1]) == 1:
			print(2)
			break
		elif j == n - 2:
			print(1)


t = int(input())
for i in range(t):
	count = 0
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(n - 1):
		if abs(l[i] - l[i + 1]) <= 1:
			count = count + 1
			break
	print(count + 1)


q = int(input())
for c in range(q):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	B = [[A[0]]]
	for i in range(0, n):
		for j in range(0, len(B)):
			if B[j][len(B[j]) - 1] != A[i] - 1 and B[j][len(B[j]) - 1] != A[i] + 1:
				B[j].append(A[i])
				break
			elif j == len(B) - 1:
				B.append([A[i]])
	print(len(B))


t = int(input())
for i in range(t):
	f = 0
	n = int(input())
	l = list(map(int, input().split()))
	a = sorted(l)
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) == 1:
			print(2)
			f = 1
			break
	if f != 1:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	skills = list(map(int, input().split()))
	count = 0
	skills.sort()
	for i in range(n - 1):
		if skills[i + 1] - skills[i] == 1:
			count += 1
		if count == 1:
			break
	if count == 1:
		print(2)
	if count == 0:
		print(1)


q = int(input())
lst = list()
for i in range(q):
	t = True
	n = int(input())
	s = sorted(list(map(int, input().split())))
	for i in range(n - 1):
		if s[i] == s[i + 1] - 1:
			t = False
			break
	if t:
		print(1)
	else:
		print(2)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	result = 0
	s = 0
	for j in range(1, len(a)):
		if a[j] - a[j - 1] > 1:
			result += 1
		else:
			s += 1
	if s != 0:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	a = [int(x) for x in input().split()]
	ans = 0
	for i in range(n):
		for j in range(i + 1, n):
			if i != j and abs(a[i] - a[j]) <= 1:
				ans += 1
	if ans == 0:
		print(1)
	else:
		print(2)


def col_com(a):
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) == 1:
			return 2
	return 1
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(col_com(a))


def divide_group(student):
	s = sorted(list(student))
	for i in range(1, len(s)):
		if s[i] - s[i - 1] == 1:
			return 2
	return 1
q = int(input())
for i in range(q):
	n = input()
	students = map(int, input().split())
	print(divide_group(students))


from functools import reduce
import os
import sys
from collections import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
inf = 1e+18
div = 998244353
for _ in range(inn()):
	n = inn()
	a = arr()
	a.sort()
	ans = 1
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			ans = 2
			break
	print(ans)


import sys
input = lambda : sys.stdin.readline()
MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : list(map(int, input().split()))
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
for _ in range(ii()):
	n = ii()
	l = il()
	lcnt = [0] * 101
	for i in l:
		lcnt[i] += 1
	fg = 0
	for i in range(100):
		if lcnt[i] and lcnt[i + 1]:
			fg = 1
	if fg == 0:
		print(1)
	else:
		print(2)


q = int(input())
for i in range(q):
	p = int(input())
	a = list(map(int, input().split()))
	c = True
	r = []
	r.append(a[0])
	for m in range(1, len(a)):
		for j in range(len(r)):
			if abs(r[j] - a[m]) <= 1:
				c = False
				break
		if c == False:
			break
		else:
			r.append(a[m])
	if c:
		print(1)
	else:
		print(2)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	cn = 0
	ch = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			ch = 0
	if ch == 0:
		print(2)
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	kq = 1
	for j in range(1, n):
		if a[j] - a[j - 1] == 1:
			kq = 2
			break
	print(kq)


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort(reverse=True)
	ans = 1
	for i in range(len(s) - 1):
		if s[i] - s[i + 1] == 1:
			ans += 1
	if ans > 1:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	ll = [0] * 101
	cnt = 0
	l.sort()
	for x in range(n):
		l[x] -= x
	for x in l:
		ll[x] += 1
	for x in ll:
		if x > cnt:
			cnt = x
	print(1 if cnt <= 1 else 2)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	flag = True
	for i in range(n):
		for j in range(i):
			flag = flag & (abs(arr[i] - arr[j]) != 1)
	print(2 - int(flag))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = input()
	v = []
	v = s.split()
	for i in range(0, len(v)):
		v[i] = int(v[i])
	v.sort()
	mare = 1
	act = 1
	for i in range(1, len(v)):
		if v[i] - v[i - 1] == 1:
			act += 1
			mare = max(mare, act)
		else:
			act = 1
	mare = max(mare, act)
	if mare > 1:
		mare = 2
	print(str(mare))


q = int(input())

def onegreater(vals):
	a = vals[0]
	n = len(vals)
	for i in range(1, n):
		if vals[i] - a == 1:
			return True
		a = vals[i]
	return False
while q:
	n = int(input())
	vals = list(map(int, input().split()))
	vals.sort()
	if onegreater(vals):
		print(2)
	else:
		print(1)
	q -= 1


for _ in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	FLAG = 0
	for i in range(N - 1):
		if L[i + 1] - L[i] == 1:
			FLAG = 1
			break
	if FLAG == 1:
		print(2)
	else:
		print(1)


queries = int(input())
while queries > 0:
	students = int(input())
	skills = []
	for numb in input().split(' '):
		skills.append(int(numb))
	cnt = 0
	skills = sorted(skills)
	for i in range(0, students - 1):
		if skills[i + 1] - skills[i] == 1:
			cnt += 1
	if cnt > 0:
		print(2)
	else:
		print(1)
	queries -= 1


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	b = sorted(a)
	t = 0
	for j in range(1, n):
		if int(b[j]) - int(b[j - 1]) == 1:
			t += 1
			break
	if t == 0:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	p = 0
	for i in range(n - 1):
		if a[i] + 1 == a[i + 1]:
			print(2)
			p = 1
			break
	if not p:
		print(1)


def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		flag = False
		i = 0
		while i + 1 < n:
			if abs(a[i] - a[i + 1]) == 1:
				flag = True
				break
			i += 1
		if flag:
			print(2)
		else:
			print(1)
main()


def main():
	q = int(input())
	for i in range(q):
		n = int(input())
		a = sorted(map(int, input().split()))
		for j in range(n - 1):
			if a[j + 1] - a[j] == 1:
				print(2)
				break
		else:
			print(1)
main()


for i in range(int(input())):
	input()
	a = list(sorted(list(map(int, input().split()))))
	bool = 0
	for j in range(len(a) - 1):
		if a[j + 1] - a[j] == 1:
			bool = 1
	print(2 if bool == 1 else 1)


q = int(input())
for i in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	f = 1
	for i in range(n - 1):
		if arr[i + 1] - arr[i] == 1:
			f = 2
			break
	print(f)


t = int(input())
for i in range(t):
	n = int(input())
	L = sorted([int(x) for x in input().split()])
	consecPairIn = False
	for j in range(n - 1):
		if L[j] + 1 == L[j + 1]:
			consecPairIn = True
			break
	print(2 if consecPairIn else 1)


q = int(input())
for qq in range(0, q):
	n = int(input())
	a = [int(x) for x in input().split()]
	foobar = False
	if n == 1:
		res = 1
	else:
		for i in range(0, n):
			if foobar:
				break
			for j in range(i, n):
				if abs(a[i] - a[j]) == 1:
					foobar = True
					break
		if foobar:
			res = 2
		else:
			res = 1
	print(res)


for _ in range(int(input())):
	ok = True
	n = int(input())
	ps = sorted(list(map(int, input().split())))
	for i in range(n - 1):
		if ps[i + 1] - ps[i] == 1:
			ok = False
			break
	if ok:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a = sorted(a)
	now = -1
	ans = 1
	for i in a:
		if abs(i - now) <= 1:
			ans = 2
			break
		now = i
	print(ans)


t = int(input())
s = []
for igkg in range(0, t):
	n = int(input())
	x = input()
	xx = x.split()
	for i in range(0, n):
		xx[i] = int(xx[i])
	xx.sort()
	for i in range(0, n - 1):
		if xx[i + 1] - xx[i] == 1:
			s.append(2)
			break
	if len(s) != igkg + 1:
		s.append(1)
for i in s:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	c = 0
	A.sort()
	for i in range(1, n):
		if A[i] - A[i - 1] < 2:
			c = 1
			break
	if c == 0:
		print(1)
	else:
		print(2)


for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	ans = 1
	for i in range(1, n):
		if ar[i] - ar[i - 1] == 1:
			ans = 2
			break
	print(ans)


t = int(input())
while t:
	n = int(input())
	a = [int(n) for n in input().split()]
	a.sort()
	count = 1
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] == 1:
			count += 1
	if count == 1:
		print(1)
	else:
		print(2)
	t = t - 1


def functionA():
	query = int(input())
	answer = []
	for _ in range(query):
		length = int(input())
		isEven = []
		isOdd = []
		numbers = [int(x) for x in str(input()).split()]
		for number in numbers:
			if number % 2 == 0:
				isEven.append(number)
			else:
				isOdd.append(number)
		while len(isEven) > 0 and isEven[-1] - 1 not in isOdd and (isEven[-1] + 1 not in isOdd):
			isOdd.append(isEven[-1])
			del isEven[-1]
		if len(isEven) > 0 and len(isOdd) > 0:
			answer.append(2)
		else:
			answer.append(1)
	for ans in answer:
		print(ans)
functionA()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	c = 1
	i = 0
	while i < n - 1:
		if a[i + 1] - a[i] == 1:
			c += 1
			break
		i += 1
	print(c)


def solve():
	q = int(input())
	for i in range(q):
		n = int(input())
		m = sorted([int(s) for s in input().split()])
		ans = 1
		for j in range(1, n):
			if m[j] - m[j - 1] == 1:
				ans = 2
		print(ans)
solve()


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 1000010
MOD = 10 ** 9 + 7
spf = [i for i in range(MAXN)]

def sieve():
	for i in range(2, MAXN, 2):
		spf[i] = 2
	for i in range(3, int(MAXN ** 0.5) + 1):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fib(n, m):
	if n == 0:
		return [0, 1]
	else:
		(a, b) = fib(n // 2)
		c = a % m * (b % m * 2 - a % m) % m
		d = a % m * (a % m) % m + b % m * b % m % m
		if n % 2 == 0:
			return [c, d]
		else:
			return [d, c + d]

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()
for _ in range(int(input())):
	n = int(input())
	a = arrIN()
	ans = 1
	a.sort()
	x = a[0]
	for i in range(1, n):
		if a[i] <= x + 1:
			ans += 1
			break
		x = a[i]
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	ls = list(map(int, input().strip().split()))
	c = 1
	f = 0
	ls.sort()
	for (ind, val) in enumerate(ls[1:], 1):
		if val == ls[ind - 1] + 1 and f == 0:
			c += 1
			f = 1
			break
		else:
			f = 0
	print(c)


I = lambda : list(map(int, input().split()))
(t,) = I()
while t:
	t -= 1
	(n,) = I()
	l = I()
	l.sort()
	ans = 1
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) == 1:
			ans = 2
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print('1')
	elif n == 2:
		if abs(arr[1] - arr[0]) > 1:
			print('1')
		else:
			print('2')
	else:
		sum = 0
		arr.sort(reverse=False)
		for i in range(n - 1):
			if arr[i + 1] - arr[i] > 1:
				sum += 1
		if sum == n - 1:
			print('1')
		else:
			print('2')


q = int(input())
ls = [list(map(int, input().split())) for _ in range(2 * q)]
n = []
a = []
for i in range(2 * q):
	if i % 2 == 0:
		n.append(ls[i])
	elif i % 2 == 1:
		a.append(ls[i])
for j in range(q):
	a[j].sort()
	l = len(a[j])
	if l == 1:
		print(1)
	else:
		for k in range(1, l):
			if a[j][k - 1] + 1 == a[j][k]:
				print(2)
				break
			elif k == l - 1:
				print(1)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	ans = 1
	for i in range(n):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) <= 1:
				ans = 2
				break
	print(ans)


import math
import copy
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	f = -1
	for i in range(1, n):
		if a[i] == a[i - 1] + 1:
			f = 0
			break
	if f == 0:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	ans = 1
	for i in range(n - 1):
		if a[i + 1] == a[i] + 1:
			ans = 2
	print(ans)


q = int(input())
for _ in range(q):
	n = int(input())
	y = list(map(int, input().split()))
	y = sorted(y)
	count = 1
	count2 = 0
	i = 1
	while i < n:
		if y[i] - y[i - 1] <= 1:
			count2 += 1
			break
		i += 1
	if count2 == 1:
		print(2)
	else:
		print(1)


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	ans = 1
	for i in range(1, n):
		if a[i] == a[i - 1] + 1:
			ans = 2
			break
	print(ans)


import array
import math
import os
import sys

def main():
	Q = read_int()
	for _ in range(Q):
		N = read_int()
		A = read_ints()
		print(solve(N, A))

def solve(N, A):
	A.sort()
	if N >= 2 and min([abs(A[i + 1] - A[i]) for i in range(N - 1)]) <= 1:
		return 2
	return 1
DEBUG = 'DEBUG' in os.environ

def inp():
	return sys.stdin.readline().rstrip()

def read_int():
	return int(inp())

def read_ints():
	return [int(e) for e in inp().split()]

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)
main()


def teams(lst):
	lst = sorted(lst)
	for t in range(len(lst)):
		if t != len(lst) - 1:
			if abs(lst[t] - lst[t + 1]) == 1:
				return 2
	return 1
l = int(input())
for i in range(l):
	input()
	print(teams([int(x) for x in input().split()]))


arg = int(input())
for a in range(0, arg):
	b = int(input())
	list1 = list(map(int, input().strip().split()))
	flag7 = 0
	for d in range(0, b):
		for n in range(d, b):
			if abs(list1[n] - list1[d]) == 1:
				flag7 = 1
				break
	if flag7:
		print(2)
	else:
		print(1)


n = int(input())
while n != 0:
	k = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	cnt = 0
	for i in range(1, len(a)):
		if a[i] - 1 == a[i - 1]:
			cnt += 1
	if cnt == 0:
		print(1)
	else:
		print(2)
	n -= 1


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	k = 0
	n = len(a)
	l = []
	a.sort()
	while n > 0:
		l.append(a[0])
		a.pop(0)
		n = n - 1
		i = 0
		while i < n:
			if a[i] - l[-1] > 1:
				l.append(a[i])
				a.pop(i)
				n = n - 1
				i -= 1
			i += 1
		k += 1
	print(k)


import sys
line_count = 0
for line in sys.stdin.readlines():
	inputs = line.split()
	if line_count == 0:
		q = int(inputs[0])
	elif line_count % 2 == 1:
		n = int(inputs[0])
	elif line_count % 2 == 0:
		even_counter = 0
		odd_counter = 0
		students = []
		for i in range(n):
			student = int(inputs[i])
			students.append(student)
			if student % 2 == 0:
				even_counter += 1
			else:
				odd_counter += 1
		if even_counter == 0 or odd_counter == 0:
			print('1')
		else:
			students.sort()
			found = False
			for i in range(len(students) - 1):
				if students[i] == students[i + 1] - 1:
					print('2')
					found = True
					break
			if not found:
				print('1')
	if line_count == 2 * q:
		break
	line_count += 1


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	a = l[0]
	lol = 1
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) == 1:
			lol = 2
			break
	print(lol)
	t -= 1


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	s = set(a)
	c = True
	for i in range(n):
		if a[i] + 1 in s:
			c = False
			break
	if c:
		print(1)
	else:
		print(2)


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, sys.stdin.readline().split(' ')))
	a.sort()
	ans = 1
	for i in range(n - 1):
		if a[i] == a[i + 1] - 1:
			ans = 2
			break
	print(ans)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


t = int(input())
for tt in range(t):
	n = int(input())
	nn = input()
	nn = nn.split()
	k = list()
	for i in nn:
		k.append(int(i))
	k.sort()
	c = 1
	i = 0
	while i < n - 1:
		if k[i + 1] - k[i] <= 1:
			c = c + 1
			break
		i = i + 1
	print(c)


def arr_inp():
	return [int(x) for x in input().split()]
for i in range(int(input())):
	(n, a) = (int(input()), arr_inp())
	a.sort()
	ans = 1
	for j in range(1, n):
		if a[j] - a[j - 1] == 1:
			ans += 1
			break
	print(ans)


t = int(input())
for e in range(0, t):
	y = []
	r = int(input())
	p = [int(a) for a in input().split(' ')]
	p.sort()
	for u in p:
		for d in y:
			for g in d:
				if g > u:
					s = g - u
				else:
					s = u - g
				if s <= 1:
					break
			else:
				d.append(u)
				break
		else:
			y.append([u])
	print(len(y))


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	f = 0
	a.sort()
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) == 1:
			f = 1
	if f == 1:
		print(2)
	else:
		print(1)


tc = int(input())
for something in range(tc):
	n = int(input())
	List = list(map(int, input().split()))
	List.sort()
	flag = True
	i = 0
	for i in range(0, n - 1):
		if List[i + 1] - List[i] == 1:
			flag = False
			break
	if flag == True:
		print(1)
	else:
		print(2)


quant = int(input())
resposta = []
while quant > 0:
	membros = int(input())
	habilits = list(map(int, input().split()))
	habilits.sort()
	listaTemp = [habilits[0]]
	flag = 0
	for i in range(1, len(habilits), 1):
		for k in range(len(listaTemp)):
			if habilits[i] - listaTemp[k] > 1:
				listaTemp[k] = habilits[i]
				flag = 0
				break
			else:
				flag = 1
		if flag == 1:
			listaTemp.append(habilits[i])
			flag = 0
	resposta.append(len(listaTemp))
	quant -= 1
for i in resposta:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(1)
	else:
		f = 0
		for i in range(n):
			for j in range(i + 1, n):
				if abs(l[i] - l[j]) == 1:
					f = 1
					break
			if f:
				break
		if f:
			print(2)
		else:
			print(1)


from collections import defaultdict, deque
from itertools import permutations
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
int_input = lambda : int(stdin.readline())
string_input = lambda : stdin.readline()
multi_int_input = lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input = lambda : list(map(int, stdin.readline().split()))
string_list_input = lambda : list(string_input())
MOD = pow(10, 9) + 7
queries = int_input()
for _ in range(queries):
	n = int_input()
	students = list_input()
	dict = {}
	count = 0
	for i in range(0, n):
		for j in range(0, n):
			if i != j:
				if abs(students[i] - students[j]) == 1:
					count += 1
	if count >= 1:
		print(2)
	else:
		print(1)


test = int(input())
while test != 0:
	number = int(input())
	arr = [int(i) for i in list(input().split())]
	min_teams = 1
	for i in range(0, number):
		if arr[i] + 1 in arr or arr[i] - 1 in arr:
			min_teams = 2
	print(min_teams)
	test -= 1


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	(seen, ans, c, prev) = (set(), 0, 0, arr[0])
	while c < n:
		(flag, i) = (0, 0)
		while i < n:
			if arr[i] not in seen and flag == 0:
				seen.add(arr[i])
				prev = arr[i]
				c += 1
				flag = 1
				ans += 1
			elif arr[i] not in seen and abs(prev - arr[i]) > 1:
				seen.add(arr[i])
				prev = arr[i]
				c += 1
				flag = 1
			i += 1
		if flag == 0:
			break
	print(ans)


from collections import defaultdict
q = int(input())
for _ in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = 0
	for i in range(n - 1):
		if abs(l[i] - l[i + 1]) == 1:
			flag = 1
			break
	if flag == 0:
		print(1)
	else:
		print(2)


q = int(input())
for k in range(q):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	r = 1
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] == 1:
			r = 2
			break
	print(r)


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	c = 1
	for i in range(n - 1):
		if l[i + 1] - l[i] == 1:
			c = 2
			break
	print(c)


q = int(input())
for qi in range(q):
	n = input()
	li = [int(i) for i in input().split(' ')]
	li.sort()
	sk = -1
	flag = 0
	for i in li:
		if i - sk <= 1:
			print(2)
			flag = 1
			break
		else:
			sk = i
	if flag == 0:
		print(1)


def main():
	for _ in range(int(input())):
		teamSize = int(input())
		team = sorted([int(i) for i in input().split()])
		ans = 1
		for i in range(0, teamSize - 1):
			if team[i + 1] - team[i] <= 1:
				ans = 2
		print(ans)
main()


n = int(input())
for i in range(n):
	n = int(input())
	a = list(map(int, input().split()))
	flg = 0
	a = sorted(a)
	for j in range(len(a) - 1):
		b = abs(a[j + 1] - a[j])
		if b == 1:
			flg = 1
	if flg == 1:
		print(2)
	else:
		print(1)


def ile():
	input()
	lista = list(map(int, input().split()))
	for i in lista:
		if i - 1 in lista or i + 1 in lista:
			return 2
	return 1
n = int(input())
for i in range(n):
	wynik = ile()
	print(wynik)


for _ in range(int(input())):
	n = int(input())
	a = set([*map(int, input().split())])
	ans = 1
	for i in a:
		if i - 1 in a or i + 1 in a:
			ans = 2
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) == 1 or a[i] - a[i - 1] == 0:
			ans = 2
	print(ans)


def team(arr):
	s = set(arr)
	for i in arr:
		if i + 1 in s or i - 1 in s:
			return 2
	return 1
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(team(arr))


n_queries = int(input())
all_skills = []
for i in range(n_queries):
	n_students = int(input())
	data = input()
	skills = [int(x) for x in data.split()]
	all_skills.append(skills)

def isValid(group, number):
	for i in group:
		if abs(i - number) == 1:
			return False
	return True
for i in range(len(all_skills)):
	all_skills[i].sort()
	all_groups = [[all_skills[i][0]]]
	del all_skills[i][0]
	for j in all_skills[i]:
		for (idx, group) in enumerate(all_groups):
			if isValid(group, j) == True:
				group.append(j)
				break
			if idx == len(all_groups) - 1:
				new_group = [j]
				all_groups.append(new_group)
	print(len(all_groups))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = sorted(l)
	flag = 0
	for i in range(n - 1):
		if a[i + 1] == a[i] + 1 or a[i + 1] == a[i]:
			print(2)
			flag = 1
			break
	if flag == 0:
		print(1)


q = int(input())
ans = []
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	k = 0
	flag = True
	for j in range(n):
		for kk in range(j + 1, n):
			if abs(a[j] - a[kk]) <= 1:
				flag = False
				break
	if flag:
		ans.append(1)
	else:
		ans.append(2)
print(*ans, sep='\n')


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	s = sorted(a)
	for (x, y) in zip(s[:-1], s[1:]):
		if y - x == 1:
			print(2)
			break
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	res = 1
	for i in range(n - 1):
		if l[i] + 1 == l[i + 1]:
			res = 2
			break
	print(res)


import math
n1 = int(input())
z = []
for j in range(n1):
	find = False
	n = int(input())
	a = list(map(int, input().split()))
	b = sorted(a)
	for i in range(len(b) - 1):
		if abs(b[i] - b[i + 1]) == 1:
			z.append(2)
			find = True
			break
	if find == False:
		z.append(1)
for i in range(len(z)):
	print(z[i])


test = int(input())
for _ in range(test):
	no = int(input())
	a = list(map(int, input().split()))
	a.sort()
	fg = 0
	for i in range(1, no):
		if abs(a[i] - a[i - 1]) == 1:
			fg = 1
			break
	if fg == 1:
		print(2)
	else:
		print(1)


for q in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	f = 0
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] == 1:
			f = 1
			break
	print(f + 1)


q = int(input())
for _ in range(q):
	n = int(input())
	A = sorted([int(x) for x in input().split()])
	print([2, 1][all([A[i + 1] - A[i] > 1 for i in range(n - 1)])])


for i in range(int(input())):
	n = int(input())
	data = list(map(int, input().split()))
	data.sort()
	if all((data[i + 1] - data[i] != 1 for i in range(n - 1))):
		print(1)
	else:
		print(2)


Q = int(input())
for _ in range(Q):
	N = int(input())
	ans = 0
	A = list(map(int, input().split()))
	A.sort()
	team = [[] for _ in range(N)]
	for i in range(N):
		for j in range(N):
			if A[i] - 1 not in team[j]:
				team[j].append(A[i])
				break
	for hoge in team:
		if len(hoge) != 0:
			ans += 1
		else:
			break
	print(ans)


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))[:n]
	a.sort()
	flag = 0
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


q = int(input())
result = []
for i in range(q):
	result.append(1)
	n = int(input())
	a = [int(o) for o in input().split()]
	a.sort()
	for k in range(len(a) - 1):
		if abs(a[k] - a[k + 1]) == 1:
			result[i] += 1
			break
for i in result:
	print(i)


import math
t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	flag = False
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) == 1:
			flag = True
			break
	if flag == True:
		print(2)
	else:
		print(1)
	t -= 1


def r():
	return map(int, input().split())
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(r())
	if n == 1:
		print(1)
	else:
		l.sort()
		can = 0
		for i in range(1, n):
			if l[i] - l[i - 1] == 1:
				can = 1
		if can:
			print(2)
		else:
			print(1)


a = int(input())
for i in range(a):
	d = int(input())
	f = list(map(int, input().split()))
	k = []
	j = 0
	b = 1
	n = 0
	for n in range(d):
		for j in range(d):
			if f[j] - 1 == f[n] or f[n] - 1 == f[j]:
				b = b + 1
			j = j + 1
		k.append(b)
		b = 1
		j = 0
	x = max(k)
	if x == 3:
		x = 2
	print(x)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	f = 0
	for i in range(n):
		for j in range(n):
			if abs(a[i] - a[j]) == 1:
				f = 1
				break
	if f == 1:
		print(2)
	else:
		print(1)


q = int(input())
ans = []
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	Max = 0
	for j in range(n):
		counta = 0
		countb = 0
		for k in range(n):
			if a[j] - a[k] == 1:
				counta += 1
			elif a[j] - a[k] == -1:
				countb += 1
		if max(counta, countb) > Max:
			Max = max(counta, countb)
	ans.append(Max + 1)
for i in range(q):
	print(ans[i])


R = lambda : list(map(int, input().split()))
(q,) = R()
for i in range(q):
	(n,) = R()
	a = sorted(R())
	l = -1
	for i in a:
		if i == l + 1:
			print(2)
			break
		l = i
	else:
		print(1)


q = int(input())

def func(sp):
	for i in sp:
		if i - 1 in sp:
			return False
	return True
for i in range(q):
	n = int(input())
	sp = input().split()
	sp = [int(sp[i]) for i in range(n)]
	if func(sp):
		print(1)
	else:
		print(2)


q = int(input())
chk = [0] * 110
for i in range(q):
	n = int(input())
	a = input().split()
	k = 0
	chk = [0] * 110
	for j in a:
		chk[int(j)] = 1
	for m in range(1, 100):
		if chk[m] == 1 and chk[m + 1] == 1:
			k = 1
			break
	if k == 0:
		print('1')
	else:
		print('2')


for j in range(int(input())):
	x = int(input())
	p = list(sorted(map(int, input().split())))
	for i in range(x):
		f = True
		if i < x - 1 and abs(p[i + 1] - p[i]) == 1:
			print(2)
			f = False
			break
	if f == True:
		print(1)


def findgroup(a):
	global num
	if len(a) == 1:
		return
	a.sort()
	rem = []
	new = []
	new.append(a[0])
	while len(a) > 1:
		if a[1] - 1 <= a[0]:
			rem.append(a[1])
			a.remove(a[1])
		else:
			a.remove(a[0])
	if len(rem) > 0:
		num += 1
		findgroup(rem)
for i in range(int(input())):
	num = 1
	n = int(input())
	a = list(map(int, input().split()))
	findgroup(a)
	print(num)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	j = 1
	while j < n and a[j] - a[j - 1] > 1:
		j += 1
	if j == n:
		print(1)
	else:
		print(2)


x = int(input())
for i in range(x):
	z = int(input())
	y = list(map(int, input().split()))
	y.sort()
	for u in range(z - 1):
		if abs(y[u] - y[u + 1]) == 1:
			print(2)
			break
		if u == z - 2:
			print(1)
	if z == 1:
		print(1)


a = int(input())
for k in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	c.sort()
	point = 0
	for k in range(1, b):
		if c[k] - c[k - 1] == 1:
			print(2)
			point += 1
			break
	if point == 0:
		print(1)


t = int(input())
for i in range(t):
	count = 0
	n = int(input())
	li = [int(num) for num in input().split(' ', n - 1)]
	li.sort()
	for i in range(len(li)):
		if i != len(li) - 1:
			if li[i + 1] - li[i] == 1:
				count += 1
		else:
			break
	if count >= 1:
		print(2)
	else:
		print(1)


t = int(input(''))
for _ in range(t):
	n = int(input(''))
	a = list(map(int, input('').split(' ')))
	d = {}
	for i in range(n):
		d[a[i]] = True
	res = 1
	for i in range(n):
		if a[i] + 1 in d:
			res = 2
			break
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	if len(set([l[i] - i for i in range(n)])) == n:
		print(1)
	else:
		print(2)


q = int(input())
for i in range(q):
	n = int(input())
	a = input().split()
	a = list(map(int, a))
	a.sort()
	L = 1
	for i in range(n - 1):
		if int(a[i + 1]) - int(a[i]) == 1:
			L = 2
	print(L)


for i in range(int(input())):
	n = int(input())
	a = sorted([int(s) for s in input().split()])
	k = 0
	for j in range(1, n):
		if a[k] + 1 == a[j]:
			print(2)
			break
		k += 1
	else:
		print(1)


q = int(input())
for ii in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	flag = True
	for i in range(1, n):
		if arr[i] - arr[i - 1] == 1:
			flag = False
			break
	if not flag:
		print(2)
	else:
		print(1)


T = int(input())
for i in range(0, T):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for j in range(0, len(a) - 1):
		if a[j] == a[j + 1] - 1:
			ans += 1
			break
	print(ans)


q = int(input())
for _ in range(q):
	n = int(input())
	A = sorted(list(map(int, input().split())))
	res = 1
	for i in range(1, n):
		if A[i - 1] + 1 == A[i]:
			res = 2
	print(res)


q = int(input())
queries = []
for i in range(q):
	n = int(input())
	queries.append(list(map(int, input().split())))
for i in range(q):
	flag = 0
	for j in queries[i]:
		if j - 1 in queries[i] or j + 1 in queries[i]:
			flag = 1
			print(2)
			break
	if flag != 1:
		print(1)


for _ in range(int(input())):
	n = int(input())
	lst = sorted([int(i) for i in input().split()])
	adj = False
	for i in range(1, n):
		if lst[i] - lst[i - 1] == 1:
			adj = True
			break
	print(2 if adj else 1)


test = int(input())
while test > 0:
	n = int(input())
	x = list(map(int, input().split()))
	x.sort()
	for i in range(1, n):
		if x[i] - x[i - 1] == 1:
			print(2)
			break
		else:
			continue
	else:
		print(1)
	test -= 1


n = int(input())
for i in range(n):
	x = int(input())
	list1 = [int(x) for x in input().split(' ')]
	list1.sort()
	list2 = []
	for i in range(1, x):
		list2.append(list1[i] - list1[i - 1])
	if list2.count(1) > 0:
		print('2')
	else:
		print('1')


T = int(input())
while T > 0:
	N = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	f = a[0]
	c = 0
	for i in range(1, len(a)):
		if abs(a[i] - f) == 1:
			c += 1
		f = a[i]
	if c > 0:
		print(2)
	else:
		print(1)
	T = T - 1


import sys

def readline():
	return input()

def fun(n, a):
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			return 2
	return 1
q = int(readline())
for i in range(q):
	n = int(readline())
	a = list(map(int, readline().split(' ')))
	a.sort()
	print(fun(n, a))


import sys
input = sys.stdin.buffer.readline
N = int(input())
for _ in range(N):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	f = 0
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) == 1:
			f = 1
			break
	if f:
		print(2)
	else:
		print(1)


q = int(input())
for i in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 1
	for k in range(n - 1):
		if abs(l[k] - l[k + 1]) == 1:
			c = c + 1
			break
		else:
			continue
	print(c)


for _ in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	if n < 2:
		print(1)
	else:
		f = False
		L.sort()
		for i in range(1, n):
			if L[i] - L[i - 1] > 1:
				continue
			else:
				f = True
				break
		if f:
			print(2)
		else:
			print(1)


f = lambda : map(int, input().split())
m = int(input())
for _ in range(m):
	n = int(input())
	l = sorted(f())
	a = 0
	for i in range(n - 1):
		if l[i] + 1 == l[i + 1]:
			a += 1
			break
	print(a + 1, end='\n')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	stack = []
	for i in range(n):
		if not stack:
			stack.append(arr[i])
		else:
			flag = 0
			for j in range(len(stack)):
				if stack[j] + 1 < arr[i]:
					stack[j] = arr[i]
					flag = 1
					break
			if flag == 0:
				stack.append(arr[i])
	print(len(stack))


n_queries = int(input())
for _ in range(n_queries):
	students = int(input())
	skills = sorted(list(map(int, input().split())))
	found = False
	for p in range(students - 1):
		if skills[p + 1] - skills[p] == 1:
			print(2)
			found = True
			break
	if not found:
		print(1)


q = int(input())
output = [1] * q
for i in range(q):
	n = int(input())
	data = [0] * n
	for j in range(0, 1):
		a = input().split(' ')
		for k in range(0, n):
			data[k] += int(a[k])
	for x in range(len(data)):
		for y in range(x + 1, len(data)):
			if abs(data[x] - data[y]) == 1:
				if output[i] == 2:
					break
				else:
					data[x] -= data[x] - 1
					data[y] -= data[y] - 1
					output[i] += 1
for i in range(len(output)):
	print(output[i])


x = int(input())
for i in range(x):
	y = int(input())
	z = list(map(int, input().split(' ')))
	z.sort()
	count = 1
	for i in range(1, len(z)):
		if z[i] - z[i - 1] == 1:
			count = 2
			break
	print(count)


for q in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	count = 1
	for i in l:
		if i + 1 in l:
			count = 2
	print(count)


q = int(input())
for query in range(q):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	a.sort()
	answer = 1
	for i in range(1, n):
		if a[i] - a[i - 1] <= 1:
			answer = 2
			break
	print(answer)


q = int(input())
while q > 0:
	q -= 1
	pairs = []
	tam = int(input())
	students = [int(x) for x in input().split()]
	students.sort()
	for i in range(1, tam):
		if students[i] - students[i - 1] == 1:
			pairs.append((i - 1, i))
	if len(pairs) == 0:
		print('1')
	else:
		print('2')


t = int(input())
for f in range(t):
	n = int(input())
	a = list(sorted(list(map(int, input().split()))))
	x = []
	y = []
	for i in range(n):
		if a[i] + 1 in x or a[i] - 1 in x:
			y.append(a[i])
		else:
			x.append(a[i])
	if len(y) > 0:
		print(2)
	else:
		print(1)


for case in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	ans = 1
	for i in range(1, n):
		if a[i] == a[i - 1] + 1:
			ans = 2
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	a = 1
	for i in arr:
		if i + 1 in arr:
			a = 2
	print(a)


n = int(input())
for i in range(n):
	m = int(input())
	ms = input().split(' ')
	for k in range(m):
		ms[k] = int(ms[k])
	ms.sort()
	t = 1
	for i in range(m - 1):
		if abs(ms[i] - ms[i + 1]) <= 1:
			t = 2
			break
	print(t)


q = int(input())
for i in range(q):
	n = int(input())
	s = [int(x) for x in input().split()]
	s.sort()
	done = False
	for i in range(1, len(s)):
		if s[i - 1] + 1 == s[i]:
			print(2)
			done = True
			break
	if not done:
		print(1)


t = int(input())
while t > 0:
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	b = []
	for i in range(1, n):
		b.append(ar[i] - ar[i - 1])
	if b.count(1) > 0:
		print(2)
	else:
		print(1)
	t -= 1


from sys import stdin
from sys import setrecursionlimit as SRL
SRL(10 ** 7)
rd = stdin.readline
rrd = lambda : map(int, rd().strip().split())
q = int(rd())
while q:
	n = int(rd())
	a = list(rrd())
	cnt = [0] * 105
	for i in a:
		cnt[i] += 1
	flag = 1
	for i in range(102):
		if cnt[i] and cnt[i + 1]:
			flag = 2
			break
	print(flag)
	q -= 1


import sys, math

def input():
	return sys.stdin.readline()[:-1]

def main():
	q = int(input())
	for _ in range(q):
		n = int(input())
		a = sorted(list(map(int, input().split())))
		ans = 1
		for k in range(1, n):
			if a[k - 1] + 1 == a[k]:
				ans = 2
				break
		print(ans)
main()


q = int(input())
while q:
	q = q - 1
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	(i, p) = (0, 0)
	while i < len(a) - 1:
		if a[i] + 1 == a[i + 1]:
			p = p + 1
		i = i + 1
	if p < 1:
		print(1)
	else:
		print(2)


n = int(input())
for i in range(0, n):
	k = int(input())
	v = []
	v = input().split()
	for j in range(0, len(v)):
		v[j] = int(v[j])
	v.sort()
	ok = 1
	for j in range(1, len(v)):
		if v[j - 1] + 1 == v[j]:
			ok = 0
			break
	if ok == 1:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	input()
	a = list(sorted(map(int, input().split())))
	print(1 + any([a[i] == a[i - 1] + 1 for i in range(1, len(a))]))


import sys
from collections import deque
readline = sys.stdin.readline
q = int(readline())
for _ in range(q):
	n = int(readline())
	p = [int(x) for x in readline().split()]
	p.sort()
	ans = 1
	if len(p) == 1:
		print(ans)
		continue
	else:
		for i in range(n - 1):
			if p[i + 1] - p[i] == 1:
				ans = 2
				break
	print(ans)


def solve():
	n = int(input())
	skills = [int(x) for x in input().split(' ')]
	skills.sort()
	ans = 1
	for ind in range(n - 1):
		if skills[ind + 1] - skills[ind] == 1:
			return 2
	return 1
q = int(input())
for i in range(q):
	ans = solve()
	print(ans)


q = int(input())
for _ in range(q):
	n = int(input())
	vetor = list(map(int, input().split()))
	vetor.sort()
	if n == 1:
		print(1)
	else:
		flag = False
		for (x, y) in zip(vetor, vetor[1:]):
			if abs(x - y) == 1:
				flag = True
		if flag:
			print(2)
		else:
			print(1)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	ls.sort()
	flag = 0
	for j in range(len(ls) - 1):
		if ls[j] == ls[j + 1] - 1:
			ans.append(2)
			flag = 1
			break
	if flag == 0:
		ans.append(1)
for k in range(t):
	print(ans[k])


for i in range(int(input())):
	input()
	a = sorted(map(int, input().split()))
	print((1, 2)[any((j - i == 1 for (i, j) in zip(a, a[1:])))])


q = int(input())
f = 0
for _ in range(q):
	n = int(input())
	p = list(map(int, input().strip().split()))
	p.sort()
	for i in range(n - 1):
		if p[i + 1] == p[i] + 1:
			print(2)
			f = 1
			break
	if f == 1:
		f = 0
		continue
	else:
		print(1)


q = int(input())
for _ in range(q):
	a = int(input())
	skills = sorted(list(map(int, input().split())))
	need_for_2 = 0
	for k in range(len(skills) - 1):
		if skills[k + 1] - skills[k] == 1:
			need_for_2 = 1
			break
	print(need_for_2 + 1)


import sys, os, io
import math
from collections import defaultdict
from io import BytesIO, IOBase
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')

def solve():
	n = ii()
	a = li()
	a.sort()
	for i in range(1, n):
		if a[i] - 1 == a[i - 1]:
			print(2)
			return
	print(1)
t = 1
t = ii()
for _ in range(t):
	solve()


from sys import stdin, exit
for _ in range(int(stdin.readline())):
	stdin.readline()
	raw = set(map(int, stdin.readline().split()))
	dif = {i - 1 for i in raw}
	if raw & dif:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	count = 0
	for i in range(n - 1):
		diff = abs(l[i + 1] - l[i])
		if diff == 1:
			count += 1
	if count >= 1:
		print(2)
	else:
		print(1)


q = int(input())
arr = []
for i in range(q):
	is_normal = True
	l = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	for p in range(l - 1):
		if abs(arr[p] - arr[p + 1]) == 1:
			is_normal = False
			break
	if is_normal:
		print(1)
	else:
		print(2)


q = int(input())
for i in range(q):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ok = 1
	for j in range(n - 1):
		if abs(a[j] - a[j + 1]) == 1:
			ok = 2
	print(ok)


n = int(input())
for i in range(n):
	a = int(input())
	b = [int(b) for b in input().split()]
	b.sort()
	count = 0
	for j in range(a - 1):
		if b[j + 1] - b[j] == 1:
			count = count + 1
	if count > 0:
		print(2)
	else:
		print(1)


from sys import stdin, stdout, setrecursionlimit
from gc import disable
gets = input
puts = print
input = stdin.readline
print = stdout.write

def main() -> int:
	disable()
	for i in range(int(input())):
		n = int(input())
		a = sorted(map(int, input().split()))
		c = True
		for i in range(n - 1):
			if a[i + 1] - a[i] == 1:
				c = False
				print('2\n')
				break
		if c:
			print('1\n')
	return 0
main()


for _ in range(int(input())):
	n = int(input())
	val = list(map(int, input().split()))
	val.sort()
	if len(val) == 2:
		if abs(val[0] - val[1]) == 1:
			print(2)
		else:
			print(1)
	elif len(val) == 1:
		print(1)
	else:
		count = 0
		for i in range(len(val) - 1):
			if abs(val[i] - val[i + 1]) == 1:
				count += 1
		if count > 0:
			print(2)
		else:
			print(1)


t = int(input())
for cases in range(t):
	n = int(input())
	s = sorted(list(map(int, input().split())))
	tot = 1
	for i in range(n - 1):
		if s[i + 1] - s[i] == 1:
			tot = 2
			break
	print(tot)


n = int(input())
for i in range(n):
	m = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = True
	for i in range(m - 1):
		if abs(a[i] - a[i + 1]) == 1:
			k = False
			break
	if k:
		print(1)
	else:
		print(2)


q = int(input())
for i in range(q):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	f = False
	for i in range(n - 1):
		if a[i] - a[i + 1] == -1:
			print(2)
			f = True
			break
	if not f:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	cnt = 1
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			cnt += 1
			break
	print(cnt)


q = int(input())
while q > 0:
	q = q - 1
	n = int(input())
	a = list(map(int, input().split()))
	k = 0
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) == 1:
				k = 1
				break
	if k == 0:
		print(1)
	else:
		print(2)


import math
t = int(input())
for k1 in range(t):
	n = int(input())
	nums = list(map(int, input().rstrip().split()))
	nums.sort()
	if len(nums) == 1:
		print(1)
	if len(nums) > 1:
		con1 = True
		for i in range(n):
			if nums[i] + 1 in nums:
				print(2)
				con1 = False
				break
		if con1:
			print(1)


q = int(input())
list = []
for query in range(q):
	n = int(input())
	v = input().split()
	caract = [0] * 101
	for skill in v:
		caract[int(skill)] += 1
	teamNr = 1
	for i in range(100):
		if caract[i] != 0 and caract[i + 1] != 0:
			teamNr += 1
			break
	list.append(teamNr)
for el in list:
	print(el)


for k in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()][:n]
	l.sort()
	s = 1
	for j in range(0, n - 1):
		if l[j + 1] - l[j] == 1:
			s = 2
			break
	print(s)


def two_consecutive_number_in_list(A):
	for i in range(0, len(A) - 1):
		if A[i + 1] == A[i] + 1:
			return True
	return False
for _ in range(int(input())):
	n = int(input())
	A = list(str(input()).split(' '))
	A = [int(x) for x in A]
	A.sort()
	if len(A) > 1 and two_consecutive_number_in_list(A):
		print(2)
	else:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	B = [0] * 999999
	k = 0
	for i in range(n):
		if A[i] % 2 == 0:
			B[A[i]] = 1
	for i in range(n):
		if A[i] % 2 == 1 and (B[A[i] - 1] == 1 or B[A[i] + 1] == 1):
			k = 1
			break
	if k == 1:
		print(2)
	else:
		print(1)


i = lambda : sorted(map(int, input().split()))
for _ in [0] * i()[0]:
	i()
	a = i()
	print(max((sum((abs(x - y) < 2 for y in a[i:])) for (i, x) in enumerate(a))))


n = int(input())
for i in range(n):
	k = int(input())
	g = sorted(list(map(int, input().split()[:k])))
	result = 1
	if len(g) < 2:
		result = 1
	else:
		for j in range(1, len(g)):
			if g[j] - g[j - 1] < 2:
				result = 2
				break
	print(result)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	team = 1
	l.sort()
	for i in range(n - 1):
		j = i + 1
		if l[i] + 1 == l[j]:
			team += 1
			break
	print(team)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	grp = 1
	for j in range(n):
		if a[j] - 1 in a or a[j] + 1 in a:
			grp = 2
			break
	print(grp)


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	isTwo = False
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			isTwo = True
			break
	if isTwo:
		print(2)
	else:
		print(1)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
from math import ceil, floor, log, sqrt, factorial
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		n = ii()
		a = li()
		a.sort()
		cnt = 1
		for i in range(n - 1):
			if a[i] + 1 == a[i + 1]:
				cnt += 1
		if cnt >= 2:
			print(2)
		else:
			print(1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	c = int(input())
	f = [int(i) for i in input().split()]
	f.sort()
	k = 1
	for i in range(1, c):
		if f[i] - f[i - 1] == 1:
			k = 2
			break
	print(k)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for j in range(n):
		f = 0
		for k in range(j, n):
			if abs(a[j] - a[k]) == 1:
				f = 1
				print(2)
				break
		if f == 1:
			break
	if f == 0:
		print(1)


tes = int(input())
for t in range(0, tes):
	team = 1
	size = int(input())
	arr = [int(i) for i in input().split()]
	for i in range(0, size):
		for j in range(i + 1, size):
			if arr[i] + 1 == arr[j] or arr[i] == arr[j] + 1:
				team = 2
				break
	print(team)


n = int(input())
for i in range(n):
	t = int(input())
	c = sorted(list(map(int, input().split())))
	f = 0
	for j in range(t - 1):
		if abs(c[j] - c[j + 1]) == 1:
			f = 1
			break
	if f == 0:
		print('1')
	else:
		print('2')


def team_format(arr, n):
	for i in range(n):
		for j in range(i + 1, n):
			if abs(arr[i] - arr[j]) == 1:
				return 2
	return 1
q = int(input())
for i in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	print(team_format(arr, n))


t = int(input())
for i in range(t):
	a = int(input())
	b = map(int, input().split())
	c = [0] * 101
	flag = 0
	for j in b:
		c[j] += 1
	for j in range(100):
		if c[j] != 0 and c[j + 1] != 0:
			flag = 1
	if flag == 1:
		print(2)
	else:
		print(1)


def solve():
	n = int(input())
	k = sorted(map(int, input().split()))
	for i in range(1, len(k)):
		if k[i] == k[i - 1] + 1:
			return 2
	return 1
q = int(input())
print(*[solve() for i in range(q)], sep='\n')


q = int(input())
for i in range(q):
	n = int(input())
	a = [int(x) for x in input().split()]
	found = False
	for j in range(n):
		for k in range(n):
			if k != j and abs(a[k] - a[j]) == 1:
				found = True
	if found:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	lis = sorted(map(int, input().split()))
	k = 0
	for i in range(n - 1):
		if lis[i] + 1 == lis[i + 1]:
			print('2')
			k = 1
			break
	if k == 0:
		print('1')


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	n = ini()
	a = sorted(inl())
	ans = False
	for i in range(n - 1):
		if a[i] + 1 == a[i + 1]:
			ans = True
			break
	print(2 if ans else 1)


def solve(arr: list, n: int):
	arr.sort()
	res = False
	for i in range(n - 1):
		if arr[i] + 1 == arr[i + 1]:
			res = True
	if res:
		return 2
	else:
		return 1

def main():
	q = int(input())
	for _ in range(q):
		n = int(input())
		arr = list(map(int, input().strip().split()))
		print(solve(arr, n))
main()


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	b = sorted(list(map(int, input().split())))
	c = []
	p = 1
	for j in range(n - 1):
		if b[j + 1] - b[j] == 1:
			p = 2
			break
	print(p)


import math
n = int(input())
a = []
for i in range(n):
	c = 1
	m = int(input())
	b = list(map(int, input().split()))
	b.sort()
	for i in range(m - 1):
		if b[i + 1] - b[i] == 1:
			c = 0
			a.append(2)
			break
	if c == 1:
		a.append(1)
for i in range(n):
	print(a[i])


def teams(arr):
	for i in range(1, len(arr)):
		if arr[i - 1] + 1 == arr[i]:
			return 2
	return 1
for i in range(int(input())):
	n = int(input())
	arr = sorted([int(elem) for elem in input().split()])
	print(teams(arr))


from sys import stdin, stdout
from collections import defaultdict as df
from collections import deque
q = int(stdin.readline())
for i in range(q):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	a = list(set(a))
	a.sort()
	flag = 0
	for i in range(n - 1):
		if a[i] == a[i + 1] - 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	arr[0:n] = map(int, input().split(' '))
	flag = 0
	for j in range(n):
		for k in range(j + 1, n):
			if arr[j] - arr[k] == 1 or arr[j] - arr[k] == -1:
				flag = 1
				break
		if flag == 1:
			break
	if flag == 1:
		print(2)
	else:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	c = 1
	a = list(map(int, input().split()))[:n]
	for i in range(len(a)):
		for j in range(i, len(a)):
			if abs(a[i] - a[j]) == 1:
				c = c + 1
	if c > 2:
		print(2)
	else:
		print(c)


for case in range(int(input())):
	n = int(input())
	sk = list(input().split())
	for i in range(n):
		sk[i] = int(sk[i])
	sk = sorted(sk)
	fl = True
	for i in range(n - 1):
		if sk[i + 1] - sk[i] == 1:
			fl = False
			break
	print(1 if fl else 2)


q = int(input())
while q > 0:
	tskl = []
	n = int(input())
	skl = str(input()).split(' ')
	if n != 1:
		skl.sort()
		teams = 1
		for i in range(1, n):
			if int(skl[i]) - int(skl[i - 1]) == 1 or int(skl[i]) - int(skl[i - 1]) == -1:
				teams += 1
				break
			elif n > 3:
				if int(skl[i]) - int(skl[i - 2]) == 1 or int(skl[i]) - int(skl[i - 2]) == -1:
					teams += 1
					break
		print(teams)
	else:
		print(1)
	q -= 1


import sys
import math
for _ in range(int(input())):
	n = int(input())
	li = sorted(list(map(int, input().split())))
	was = 0
	for i in range(n - 1):
		if li[i + 1] - li[i] == 1:
			was = 1
	if was:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = []
	ans.append([a[0]])
	b = a[1:]
	for i in b:
		flag = False
		for el in ans:
			if el[-1] != i - 1:
				el.append(i)
				flag = True
				break
		if not flag:
			ans.append([i])
	print(len(ans))


t = int(input())
while t:
	t -= 1
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	flag = 0
	i = 0
	while i < n - 1:
		if abs(ar[i] - ar[i + 1]) == 1:
			flag = 1
			break
		i += 1
	if flag == 1:
		print(2)
	else:
		print(1)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	flag = True
	a.sort()
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			flag = False
			break
	if flag:
		print(1)
	else:
		print(2)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = 0
	for i in range(n):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) == 1:
				cnt += 1
	if cnt == 0:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	x = int(input())
	y = list(map(int, input().split()))
	c = 0
	for i in range(x - 1):
		for j in range(x):
			if abs(y[i] - y[j]) == 1:
				c += 1
	if c == 0:
		print('1')
	else:
		print('2')


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	flag = 1
	for j in range(1, n):
		if s[j] - s[j - 1] == 1:
			print(2)
			flag = 0
			break
	if flag == 1:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	s = 1
	for j in range(n - 1):
		if a[j + 1] - a[j] == 1:
			s = 2
	print(s)


case = int(input())
for _ in range(case):
	n = int(input())
	ar = list(map(int, input().split()))
	ar = sorted(ar)
	two = False
	cnt = 1
	for i in range(1, n):
		if ar[i] - ar[i - 1] == 1:
			cnt += 1
			if cnt == 2:
				print('2')
				two = True
				break
	if not two:
		print('1')


q = int(input())
for i in range(q):
	int(input())
	a = sorted(list(map(int, input().split())))
	k = 1
	for j in range(1, len(a)):
		if a[j] - a[j - 1] == 1:
			k = 2
			break
	print(k)


n = int(input())
for _ in range(n):
	a = int(input())
	li = list(map(int, input().split()))
	li.sort()
	b = li[0]
	j = 1
	for i in range(1, len(li)):
		if li[i] - b == 1:
			j += 1
		if j == 2:
			break
		b = li[i]
	print(j)


q = int(input())
res = []
for i in range(q):
	n = int(input())
	r = list(map(int, input().split(' ')))
	r.sort()
	d = True
	for i in range(1, len(r)):
		if r[i] - r[i - 1] == 1:
			res.append(2)
			d = False
			break
	if d:
		res.append(1)
for i in res:
	print(i)


t = int(input())
for z in range(t):
	n = int(input())
	p = list(map(int, input().rstrip().split()))
	s = set()
	for i in p:
		if i - 1 in s or i + 1 in s:
			count = 2
			break
		else:
			s.add(i)
			count = 1
	print(count)


import math

def solve(test):
	ans = 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(n - 1):
		if a[i] + 1 == a[i + 1]:
			ans = 2
			break
	print(ans)
t = int(input())
for _ in range(t):
	solve(_ + 1)


q = int(input())
answers = []
for qi in range(q):
	n = int(input())
	students = list(map(int, input().split()))
	students.sort()
	teams = []
	first = {students[0]: 1}
	teams.append(first)
	for i in range(1, len(students)):
		joined = False
		for t in range(len(teams)):
			team = teams[t]
			if students[i] + 1 not in team and students[i] - 1 not in team:
				team[students[i]] = 1
				joined = True
				break
		if not joined:
			teams.append({students[i]: 1})
	answers.append(len(teams))
for a in answers:
	print(a)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().strip().split()))
	l.sort()
	flag = 0
	for i in range(0, n - 1):
		if l[i + 1] - l[i] <= 1:
			flag = 1
			print(2)
			break
	if flag == 0:
		print(1)


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	f = 1
	for i in range(0, n - 1):
		if a[i + 1] - a[i] == 1:
			f = 0
			break
	if f:
		print(1)
	else:
		print(2)


total = int(input())
for i in range(total):
	numstudents = int(input())
	students = [int(x) for x in input().split()]
	students.sort()
	aux = 0
	for j in range(numstudents):
		if students[j] + 1 in students or students[j] - 1 in students:
			aux = 1
			break
	if aux:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	x = 0
	f = 0
	a.sort()
	m = a[0]
	if n == 1:
		print(1)
	elif n == 2:
		if a[1] - a[0] != 1:
			print(1)
		else:
			print(2)
	else:
		for i in range(1, n):
			if a[i] - m != 1:
				m = a[i]
				f = 1
			else:
				x = 1
		print(x + f)


def solve():
	input()
	a = [int(x) for x in input().split()]
	a = sorted(a)
	a = [x - y for (x, y) in zip(a[1:], a[:-1])]
	return 2 if a.count(1) != 0 else 1
n = int(input())
for i in range(n):
	print(solve())


def main():
	n = int(input())
	skills = list(map(int, input().split()))
	skills.sort()
	for i in range(n):
		if skills[i] - skills[i - 1] == 1:
			print(2)
			return 0
	print(1)
	return 0
a = int(input())
for i in range(a):
	main()


from math import *
from sys import *
from heapq import *
from collections import defaultdict
from itertools import permutations
import os, sys
from io import IOBase, BytesIO
M = 10 ** 9 + 7

def graph_as_tree_1_root():
	n = int(input())
	dict = defaultdict(list)
	for _ in range(n - 1):
		(x, y) = list(map(int, input().split()))
		dict[x].append(y)
		dict[y].append(x)
	tree = [[1]]
	temp = [1]
	vall = 0
	seen = set([i for i in range(2, n + 1)])
	lol = []
	while len(seen) > 0:
		lol = list(seen)
		tt = []
		for x in temp:
			aa = []
			for val in dict[x]:
				if val in seen:
					aa += [val]
					seen.remove(val)
			dict[x] = aa
			tt += aa
		tree.append(tt)
		temp = tt
		vall += 1
	for x in lol:
		dict[x] = []
	print(tree, dict)

def pow(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res

def powmod(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b //= 2
	return res

def inv(a, m):
	return powmod(a, m - 2, m)

def alldivisors(n):
	list = []
	arr = []
	for i in range(1, int(sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				arr += [i]
			else:
				arr += [i]
				list.append(n // i)
	arr += list[::-1]
	return arr

def primefactorisation(n):
	potentional_p = 3
	itog_list = defaultdict(int)
	if n % 2 == 0:
		itog_list[2] = 0
	while n % 2 == 0:
		n = n // 2
		itog_list[2] += 1
	while n - 1:
		if potentional_p > n ** 0.5:
			itog_list[n] += 1
			return itog_list
		while n % potentional_p == 0:
			n = n // potentional_p
			itog_list[potentional_p] += 1
		potentional_p += 2
	return itog_list

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		res = 0
		for i in range(n - 1):
			if a[i + 1] - a[i] == 1:
				res += 1
		if res + 1 >= 2:
			print(2)
		else:
			print(1)
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	x = int(input())
	s = sorted(list(map(int, input().split())))
	even = []
	odd = []
	indicator = 0
	for n in range(x):
		if s[n] % 2 == 0:
			even.append(s[n])
		else:
			odd.append(s[n])
	for n in even:
		if n + 1 in odd:
			indicator = 1
			break
		elif n - 1 in odd:
			indicator = 1
			break
		else:
			indicator = 0
	if indicator == 1:
		print(2)
	else:
		print(1)


for i in ' ' * int(input()):
	n = int(input())
	m = sorted(list(map(int, input().split())))
	flag = 1
	for j in range(n - 1):
		if m[j + 1] - m[j] == 1:
			flag = 2
	print(flag)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	if len(a) == 1:
		print(1)
	elif len(a) == 2:
		if abs(a[0] - a[1]) == 1:
			print(2)
		else:
			print(1)
	else:
		a.sort()
		for i in range(1, len(a)):
			if abs(a[i] - a[i - 1]) == 1:
				flag = 1
				break
		if flag == 1:
			print(2)
		else:
			print(1)


q = int(input())
R = []
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	r = 0
	for j in range(n - 1):
		if len(a) == 1:
			R.append(1)
		else:
			for m in range(len(a) - j - 1):
				if abs(a[j] - a[m + j + 1]) == 1:
					r = r + 1
	if r > 0:
		R.append(2)
	else:
		R.append(1)
for k in range(q):
	print(R[k])


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	c = 0
	for j in range(1, n):
		k = a[j] - a[j - 1]
		if k == 1:
			c = 1
			break
	print(c + 1)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0 for i in range(100 + 2)]
	for i in range(n):
		b[a[i]] += 1
	flag = False
	for i in range(1, 101):
		if b[i] == 1 and (b[i + 1] == 1 or b[i - 1] == 1):
			flag = True
	if flag:
		print(2)
	else:
		print(1)


q = int(input())
while q:
	n = int(input())
	ans = 1
	a = list(map(int, input().split()))
	a.sort()
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] == 1:
			ans = 2
			break
	print(ans)
	q -= 1


q = int(input())
ans_arr = []
for i in range(q):
	n = int(input())
	a = [int(i) for i in input().split()]
	if n == 1:
		ans_arr.append(str(1))
	else:
		a.sort()
		teams = 1
		for x in range(1, n):
			if a[x] - a[x - 1] == 1:
				teams = 2
				break
		ans_arr.append(str(teams))
print('\n'.join(ans_arr))


from math import ceil
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	count = 0
	i = 1
	while i < n:
		if a[i] - a[i - 1] == 1:
			count += 1
			i += 1
		i += 1
	if count > 0:
		ans = 2
	else:
		ans = 1
	print(ans)


q = int(input())
for l in range(0, q):
	k = 1
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(0, len(a)):
		for j in range(i, len(a)):
			if a[i] + 1 == a[j] or a[i] - 1 == a[j]:
				k = 2
	print(k)


for _ in range(int(input())):
	n = int(input())
	s = set(map(int, input().split()))
	print([1, 2][any((e - 1 in s for e in s))])


q = int(input())
lst = []
for i in range(q):
	input().strip()
	lst += [list(map(int, input().strip().split(' ')))]
for i in range(q):
	cur_list = lst[i]
	verdict = 1
	for j in range(len(cur_list)):
		for k in range(1, len(cur_list)):
			if verdict != 2:
				try:
					(num1, num2) = (cur_list[j], cur_list[j + k])
				except IndexError:
					break
				if abs(num1 - num2) == 1:
					verdict = 2
	print(verdict)


for i in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	for j in range(n):
		if s[j] == s[j - 1] + 1:
			a = 2
			break
		else:
			a = 1
	print(a)


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	s = 1
	for i in range(n - 1):
		if arr[i + 1] - arr[i] == 1:
			s = 2
			break
	print(s)
	t -= 1


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	p = 0
	l.sort()
	for j in range(n - 1):
		if l[j + 1] - l[j] == 1:
			p += 1
			break
	if p != 0:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	result = 1
	for i in range(n - 1):
		if l[i + 1] - l[i] == 1:
			result = 2
			break
	print(result)


for i in range(int(input())):
	n = int(input())
	ele = list((int(x) for x in input().split()))
	ele.sort()
	flag = False
	for j in range(n - 1):
		if ele[j + 1] - ele[j] == 1:
			print(2)
			flag = True
			break
	if not flag:
		print(1)


for _ in range(int(input())):
	n = int(input())
	skills = sorted(map(int, input().split()))
	diff = []
	for i in range(1, n):
		diff.append(skills[i] - skills[i - 1])
	if 1 in diff:
		print(2)
	else:
		print(1)


q = int(input())
an = []
d = [1] * q
for i in range(q):
	n = int(input())
	l = [int(j) for j in input().split()]
	l.sort()
	while len(l) != 0:
		j = 0
		an.append(l[0])
		l.pop(0)
		while j < len(l):
			if an.count(l[j] + 1) < 1 and an.count(l[j] - 1) < 1 and (an.count(l[j]) < 1):
				an.append(l[j])
				l.pop(j)
				j -= 1
			j += 1
		if j != 0:
			d[i] += 1
		for j in range(len(an)):
			an.pop()
for i in range(q):
	print(d[i])


cases = int(input())
for case in range(cases):
	n = input()
	students = sorted(list(map(int, input().split())))
	total = 1
	for i in range(1, len(students)):
		if abs(students[i - 1] - students[i]) == 1:
			total += 1
			break
	print(total)


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	count = 0
	l = [0] * n
	for i in range(0, n):
		for j in range(i + 1, n):
			if a[i] == a[j]:
				l[i] += 1
	c = max(l)
	if n == 1:
		print(1)
	elif c >= 2:
		print(c)
	else:
		for i in range(0, n):
			for j in range(i + 1, n):
				if a[i] - a[j] == 1:
					print(2)
					flag = 1
					break
				elif a[j] - a[i] == 1:
					print(2)
					flag = 1
					break
				else:
					flag = 0
			if flag == 1:
				break
		if flag == 0:
			print(1)


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	k = 1
	s.sort()
	for i in range(1, n):
		if abs(s[i] - s[i - 1]) == 1:
			k += 1
			break
	print(k)


n = int(input())
for i in range(n):
	m = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	for i in range(m - 1):
		if l[i] - l[i + 1] == 1 or l[i] - l[i + 1] == -1:
			print(2)
			break
	else:
		print(1)


t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	c = 't'
	flag = 0
	k = 1
	if n == 1:
		print(1)
	else:
		while flag == 0:
			if a[k] - a[k - 1] == 1:
				flag = 1
				c = 'f'
			if k == n - 1:
				flag = 1
			k = k + 1
		if c == 'f':
			print(2)
		else:
			print(1)


q = int(input())
for i in range(q):
	n = int(input())
	arr = []
	count = 0
	arr.append(list(map(int, input().split())))
	arr = arr[0]
	for j in range(len(arr) - 1):
		for k in range(j + 1, len(arr)):
			if abs(arr[j] - arr[k]) == 1:
				count += 1
	if count < 1:
		print('1')
	else:
		print('2')


n = int(input())
out = ''
for i in range(n):
	k = int(input())
	s = list(map(int, input().split(' ')))
	flag = False
	for j in range(k):
		cnt = 0
		for t in range(k):
			if j != t:
				if abs(s[j] - s[t]) == 1:
					flag = True
	out += str(1 + flag) + '\n'
print(out[:-1])


n = int(input())
c = []
for i in range(n):
	a = int(input())
	b = [int(x) for x in input().split()]
	s = 1
	b.sort()
	for j in range(a - 1):
		if b[j + 1] - b[j] == 1:
			s = 2
			break
	c.append(s)
for i in c:
	print(i)


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	a.sort()
	b = []
	for j in range(len(a)):
		b.append(0)
	prev = -100000
	for j in range(len(a)):
		if b[j] == 0:
			prev = a[j]
			k = j
			while k + 1 < len(a):
				if abs(prev - a[k + 1]) != 1 and b[k + 1] == 0:
					b[k + 1] = 1
					prev = a[k + 1]
				k += 1
			b[j] = 1
			ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	t = 0
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) == 1:
			t = True
	if t:
		print(2)
	else:
		print(1)


q = int(input())
while q:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	count = 0
	for i in range(len(l)):
		for j in range(len(l)):
			if l[i] - l[j] == 1:
				count += 1
	if count == 0:
		print(1)
	else:
		print(2)
	q = q - 1


t = int(input())
for _ in range(t):
	_ = input()
	a = sorted(map(int, input().split()))
	for (index, _) in enumerate(a[:-1]):
		if a[index + 1] - a[index] <= 1:
			print(2)
			break
	else:
		print(1)


def teams(arr):
	arr.sort()
	for i in range(1, len(arr)):
		if abs(arr[i - 1] - arr[i]) == 1:
			return 2
	return 1
q = int(input())
for i in range(q):
	n = int(input())
	x = list(map(int, input().rstrip().split()))
	print(teams(x))


INF = 500050
a = [0] * INF
t = eval(input())
while t:
	cnt = 1
	t -= 1
	n = eval(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	falg = False
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			falg = True
			break
	o = 0
	j = 0
	for i in a:
		if i % 2 == 0:
			o += 1
		else:
			j += 1
	if o and j:
		if falg:
			print('2')
		else:
			print('1')
	else:
		print('1')


t = int(input())
while t:
	n = int(input())
	ar = sorted([int(x) for x in input().split()])
	for i in range(0, n - 1):
		if ar[i] + 1 == ar[i + 1]:
			print(2)
			break
	else:
		print(1)
	t -= 1


import sys
from collections import defaultdict
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	for i in range(1, n):
		if lis[i] - lis[i - 1] == 1:
			print(2)
			break
	else:
		print(1)


q = int(input())
for i in range(q):
	k = int(input())
	A = list(map(int, input().split()))
	A.sort()
	if k == 1:
		print(1)
		continue
	for j in range(k - 1):
		if A[j + 1] - A[j] == 1:
			print(2)
			break
		elif j == k - 2:
			print(1)


q = int(input())
while q != 0:
	n = int(input())
	skill = list(map(int, input().split()))
	skill = sorted(skill)
	c = 0
	for i in range(0, len(skill) - 1):
		if abs(skill[i] - skill[i + 1]) == 1:
			c = 1
	if c == 1:
		print(2)
	else:
		print(1)
	q = q - 1


for i in range(int(input())):
	n = int(input())
	lst1 = list(map(int, input().split()))
	lst1.sort()
	flag = False
	for i in range(1, len(lst1)):
		if lst1[i] - lst1[i - 1] <= 1:
			flag = True
			break
	if flag:
		print(2)
	else:
		print(1)


for q in range(int(input())):
	n = int(input())
	a = list(sorted([int(x) for x in input().split()]))
	mid = 2
	for i in range(len(a) - 1):
		mid = min(mid, a[i + 1] - a[i])
	print(1 if mid == 2 else 2)


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
q = int(input())
for i in range(0, q):
	n = int(input())
	a = li()
	c = e = f = 0
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] <= 1:
			f = 1
	if f == 0:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	a = sorted([*map(int, input().split())])
	print(2 if len([1 for (x, y) in zip(a[:n - 1], a[1:]) if y - x == 1]) >= 1 else 1)


responses = []
q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	diff_one = False
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) == 1:
			diff_one = True
			break
	response = 2 if diff_one else 1
	responses.append(response)
for response in responses:
	print(response)


q = int(input())
for j in range(q):
	n = int(input())
	students = sorted(map(int, input().split()))
	for i in range(1, len(students)):
		if students[i] - students[i - 1] == 1:
			print(2)
			break
	else:
		print(1)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	count = 1
	for _ in range(len(a)):
		for __ in range(len(a)):
			if a[_] - a[__] == 1:
				count += 1
		if count == 2:
			break
	print(count)


t = int(input())
while t != 0:
	students = int(input())
	flag = False
	s1 = sorted([int(i) for i in input().split()])
	for i in range(students - 1):
		if s1[i + 1] - s1[i] == 1:
			flag = True
			break
	if flag:
		print(2)
	else:
		print(1)
	t -= 1


q = int(input())
T = [0] * (2 * q)
for i in range(q):
	T[2 * i] = int(input())
	T[2 * i + 1] = list(map(int, input().split()))
	T[2 * i + 1] = sorted(T[2 * i + 1])
for i in range(q):
	H = T[2 * i + 1]
	rep = True
	p = 0
	while rep and H != []:
		rep = False
		p = p + 1
		S = [H[0]]
		if len(H) == 1:
			rep = False
		else:
			H.pop(0)
			j = 0
			while j < len(H):
				rep = True
				if not H[j] in [S[k] + 1 for k in range(len(S))] + [S[k] - 1 for k in range(len(S))]:
					S.append(H[j])
					H.pop(j)
				else:
					j = j + 1
	print(p)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
q = inp()
for i in range(q):
	n = inp()
	li = inlt()
	if n == 1:
		print(1)
	elif n == 2:
		x = abs(li[0] - li[1])
		if x == 1:
			print(2)
		else:
			print(1)
	else:
		flag = 1
		for j in range(0, len(li)):
			for k in range(j + 1, len(li)):
				if abs(li[j] - li[k]) == 1:
					flag = 0
					break
		if flag == 0:
			print(2)
		else:
			print(1)


from math import *
t = int(input())
for y in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			flag = 1
			break
	if flag == 1:
		print(2)
	else:
		print(1)


a = input().split()
a = int(a[0])
L = []
for j in range(a):
	b = input().split()
	b = int(b[0])
	L = list(map(int, input().split()))
	L.sort()
	y = 1
	if len(L) == 1:
		print(1)
		continue
	for i in range(len(L) - 1):
		if abs(L[i] - L[i + 1]) == 1:
			print(2)
			y = -1
			break
	if y == 1:
		print(1)


from math import *
q = int(input())
a = []
for i in range(q):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	s = 0
	for j in range(1, len(A)):
		if A[j] - A[j - 1] <= 1:
			s = 1
			break
	a.append(s)
for i in range(len(a)):
	if a[i] == 0:
		print(1)
	else:
		print(2)


t = int(input())
while t > 0:
	n = int(input())
	a = []
	b = []
	a = input().split()
	for i in a:
		b.append(int(i))
	j = 1
	b.sort()
	for i in range(n - 1):
		if int(b[i + 1]) - int(b[i]) == 1:
			print('2')
			break
		j += 1
	if j == n:
		print('1')
	t -= 1


for _ in range(int(input())):
	q = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = 0
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] == 1:
			flag = 1
			break
	if flag == 0:
		print(1)
	elif flag == 1:
		print(2)


for i in range(int(input())):
	f = True
	input()
	a = input().split()
	for j in range(len(a)):
		a[j] = int(a[j])
	a = sorted(a)
	for j in range(len(a) - 1):
		if abs(a[j] - a[j + 1]) == 1:
			f = False
			break
	if f == False:
		print(2)
	else:
		print(1)


import sys
q = int(input())
for case in range(q):
	n = int(input())
	a = sorted(map(int, input().split()))
	team = 1
	for i in range(n):
		if i + 1 < n and a[i] + 1 == a[i + 1]:
			team = 2
			break
	print(team)


for _ in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	c = 1
	for i in range(len(L)):
		for j in range(i + 1, len(L)):
			if abs(L[i] - L[j]) == 1:
				c = c + 1
	if c >= 2:
		print(2)
	else:
		print(1)


T = int(input())
for t in range(T):
	N = int(input())
	Q = list(map(int, input().split(' ')))
	Q.sort()
	count = 1
	for n in range(1, N):
		if Q[n - 1] == Q[n] - 1:
			count += 1
			break
	print(count)


n = int(input())
for iwe in range(n):
	q = int(input())
	l = list(map(int, input().split()))
	l.sort()
	odp = 1
	for i in range(1, q):
		if l[i] == 1 + l[i - 1]:
			odp += 1
			break
	print(odp)


for x in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	t = 1
	for i in range(n - 1):
		if l[i + 1] - l[i] == -1 or l[i + 1] - l[i] == 1:
			t = 0
			break
	if t == 1:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	req = False
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) == 1:
			req = True
			break
	if req:
		print(2)
	else:
		print(1)


import time
import string
LOCAL = False
start_time = None
if LOCAL:
	start_time = time.time()
q = int(input())
while q:
	q -= 1
	n = int(input())
	ais = list(map(lambda x: int(x), input().split(' ')))
	w = False
	qqq = sorted(ais)
	for (i, v) in enumerate(qqq[1:]):
		if v - qqq[i] == 1:
			w = True
	print(2 if w else 1)
if LOCAL:
	print('--- %s seconds ---' % (time.time() - start_time))


T_ON = 1
DEBUG_ON = 0
MOD = 998244353

def solve():
	n = read_int()
	A = read_ints()
	A.sort()
	for i in range(1, n):
		if A[i] - A[i - 1] == 1:
			print(2)
			return
	print(1)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


for _ in range(int(input())):
	m = int(input())
	k = list(map(int, input().split()))
	f = 0
	k.sort()
	for j in range(m - 1):
		if abs(k[j] - k[j + 1]) == 1:
			f = 1
			break
	if f == 1:
		print(2)
	else:
		print(1)


nquery = int(input())
iters = 0
while iters < nquery:
	iters += 1
	qlength = input()
	students = list(map(int, input().split()))
	students.sort()
	for i in range(len(students) - 1):
		if students[i] + 1 == students[i + 1]:
			print('2')
			break
	else:
		print('1')


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	n = int(I())
	arr = list(map(int, I().split()))
	grp = [arr[0]]
	for i in range(1, n):
		flag = 1
		for j in range(len(grp)):
			if abs(grp[j] - arr[i]) <= 1:
				flag = 0
				break
		if flag:
			grp.append(arr[i])
	if n - len(grp) > 0:
		ans += '{}\n'.format(2)
	else:
		ans += '{}\n'.format(1)
print(ans)


q = int(input())
for w in range(q):
	n = int(input())
	a = [int(i) for i in input().split()]
	count = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) == 1:
				count += 1
	if count > 0:
		print(2)
	else:
		print(1)


q = int(input())
for queries in range(q):
	n = int(input())
	skill = list(map(int, input().split()))
	skill.sort()
	times = 1
	for i in range(len(skill) - 1):
		if skill[i + 1] - skill[i] == 1:
			times = 2
	print(times)


t = int(input())
for test in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	k = [list() for i in range(n)]
	flag = 0
	for i in range(n):
		for j in range(i + 1, n):
			if abs(arr[i] - arr[j]) == 1:
				flag = 1
	if flag == 1:
		print(2)
	else:
		print(1)


import sys

def init(a):
	for i in range(150):
		a.append(0)
case = int(input())
for i in range(case):
	flag = False
	a = list()
	init(a)
	n = int(input())
	nums = sys.stdin.readline().split()
	for j in range(len(nums)):
		k = int(nums[j])
		if a[k] == 1:
			flag = True
			break
		a[k + 1] = a[k - 1] = 1
	if flag:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	s = set(a)
	for i in range(n):
		k = 0
		if a[i] - 1 in s or a[i] + 1 in s:
			print(2)
			break
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 1
	cnts = 0
	while i < n:
		if a[i] - 1 == a[i - 1]:
			curr_cnt = 1
			while i < n and a[i] - 1 == a[i - 1]:
				curr_cnt += 1
				i += 1
			cnts += curr_cnt
		else:
			i += 1
	if cnts == 0:
		print(1)
	else:
		print(2)


t = int(input())
from collections import defaultdict
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))[:n]
	store = defaultdict(int)
	ans = 0
	for num in arr:
		if store[num + 1] == True or store[num - 1] == True:
			ans = 2
			break
		else:
			store[num] = True
			ans = 1
	print(ans)


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input = sys.stdin.readline
from random import randint
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	n = inin()
	a = ain()
	c = 2
	a.sort()
	for i in range(1, n):
		c = min(c, a[i] - a[i - 1])
	if c == 1:
		print(2)
	else:
		print(1)


q = int(input())
for test in range(q):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	ans = False
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			ans = True
	if ans == True:
		print(2)
	else:
		print(1)


def minimize(arr):
	if arr:
		put = [arr[0]]
		del arr[0]
		i = 0
		while True:
			if i == len(arr):
				break
			if arr[i] > put[-1] + 1:
				put.append(arr[i])
				del arr[i]
			else:
				i += 1
	return (put, arr)
t = int(input())
for i in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	x = sorted(x)
	ctr = 0
	for j in range(1, len(x)):
		if x[j] - x[j - 1] == 1:
			ctr += 1
	if ctr == 0:
		print(1)
	else:
		print(2)


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return [x for x in mi()]

def si():
	return stdin.readline()
for _ in range(ii()):
	n = ii()
	a = li()
	a.sort()
	x = 1
	for i in range(1, n):
		if a[i] - a[i - 1] == 1:
			x = 2
			break
	print(x)


q = int(input())
for i in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	done = 0
	for j in range(n - 1):
		if l[j] + 1 == l[j + 1]:
			done = 1
			break
	if done:
		print(2)
	else:
		print(1)


ii = lambda : int(input())
kk = lambda : map(int, input().split())
ll = lambda : list(kk())
for _ in range(ii()):
	(n, ls) = (ii(), sorted(kk()))
	prev = -1
	for v in ls:
		if v - prev == 1:
			print(2)
			break
		prev = v
	else:
		print(1)


q = int(input())
for j in range(q):
	n = int(input())
	ch = input()
	L = ch.split()
	for i in range(n):
		L[i] = int(L[i])
	L.sort()
	nb = 1
	for i in range(n - 1):
		if L[i + 1] - L[i] == 1:
			nb = 2
			break
	print(nb)


def ab():
	a = input()
	sum = 1
	b = list(map(int, input().split()))
	for i in range(0, len(b) - 1):
		for j in range(i + 1, len(b)):
			if abs(b[i] - b[j]) == 1:
				sum = 2
	print(sum)
k = input()
for i in range(0, int(k)):
	ab()


import sys
import math
from collections import defaultdict
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : map(int, input().split())

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}'.format(i) + sep)
INF = float('inf')
MOD = int(1000000000.0 + 7)
for _ in range(int(input())):
	n = int(input())
	arr = list(read())
	flag = True
	for i in arr:
		for j in arr:
			if i == j:
				continue
			elif abs(i - j) == 1:
				flag = False
	if flag:
		print(1)
	else:
		print(2)


T = int(input())
for i in range(T):
	n = int(input())
	A = set(map(int, input().strip().split()))
	f = 0
	for j in A:
		if j - 1 in A or j + 1 in A:
			f = 1
			break
	if f == 1:
		print(2)
	else:
		print(1)


query = int(input())
for _ in range(query):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	result = 1
	for i in range(1, n):
		if arr[i] - arr[i - 1] == 1:
			result = 2
			break
	print(result)


for _ in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	P = True
	for i in range(N):
		for j in range(i):
			P &= abs(L[i] - L[j]) != 1
	print(2 - P)


q = int(input())
for _ in range(q):
	n = int(input())
	d = {}
	arr = [int(i) for i in input().split()]
	boo = True
	for i in arr:
		if i + 1 in d.keys() or i - 1 in d.keys():
			boo = False
			print(2)
			break
		else:
			d[i] = 1
	if boo:
		print(1)


t = int(input())
while t > 0:
	n = int(input())
	A = list(map(int, input().split()))
	(a, b) = ([], [])
	A.sort()
	count = 1
	for i in range(len(A) - 1):
		if A[i + 1] - A[i] == 1:
			count += 1
	if count > 1:
		print(2)
	else:
		print(1)
	t -= 1


n = int(input())
for i in range(n):
	c = 0
	s = int(input())
	k = list(map(int, input().split()))
	k = sorted(k)
	for j in range(1, s):
		if abs(k[j - 1] - k[j]) == 1:
			c += 1
	if c >= 1:
		print('2')
	else:
		print('1')


q = int(input())
ans = []
for _ in range(q):
	n = int(input())
	skills = [int(x) for x in input().split()]
	skills.sort()
	_ans = 1
	for i in range(1, n):
		if skills[i] == skills[i - 1] + 1:
			_ans = 2
			break
	ans.append(_ans)
for _ans in ans:
	print(_ans)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	A = sorted(LIST())
	ans = 1
	for i in range(1, N):
		if A[i] - A[i - 1] == 1:
			ans = 2
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = [int(i) for i in input().split()][:n]
	count = 0
	for i in range(0, n):
		for j in range(0, n):
			if abs(l[i] - l[j]) == 1:
				count += 1
	if count == 0:
		print('1')
	else:
		print('2')


for i in range(int(input())):
	k = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 1
	for i in a:
		if i - 1 in a:
			c = 2
			break
	print(c)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			c = 1
			break
	print(c + 1)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	count = 0
	l = len(a) - 1
	while l >= 0:
		for i in a:
			if a[l] - i == 1:
				count += 1
		l -= 1
	if count != 0:
		print(2)
	else:
		print(1)


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	LastA = 999
	dupA = []
	best = 0
	for i in a:
		if abs(i - LastA) == 1:
			dupA.append([LastA, i])
		LastA = i
	for i in dupA:
		A0 = a.count(i[0])
		A1 = a.count(i[1])
		if A0 > A1:
			if A1 > best:
				best = A1
		elif A0 > best:
			best = A0
	print(best + 1)


t = int(input())
for i in range(t):
	m = int(input())
	n = input()
	n = n.split()
	for j in range(m):
		n[j] = int(n[j])
	n.sort()
	counter = 0
	for j in range(1, m):
		if n[j] - n[j - 1] <= 1:
			counter += 1
	if counter == 0:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	e = 0
	o = 0
	a.sort()
	ans = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			ans += 1
			break
	print(ans)


import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right

def find(a):
	mi = 10
	ma = 0
	for i in str(a):
		if int(i) > ma:
			ma = int(i)
		if int(i) < mi:
			mi = int(i)
	return (mi, ma)
t = 1
t = int(input())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	ans = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			ans = 2
			break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	cnt = 0
	l.sort()
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] == 1:
			cnt = 99
			print(2)
			break
		else:
			cnt = 0
			continue
	if cnt == 0:
		print(1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	if n == 1:
		ans = 1
	else:
		for i in range(n - 1):
			if a[i + 1] - a[i] == 1:
				ans = max(ans, 2)
			else:
				ans = max(ans, 1)
	print(ans)


def teamDivide(arr):
	arr.sort()
	for i in range(1, len(arr)):
		if arr[i] - arr[i - 1] < 2:
			return 2
	return 1
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(teamDivide(arr))


q = int(input())
for i in range(q):
	num = 1
	team = []
	n = int(input())
	s = input()
	team = s.split(' ')
	team = list(map(int, team))
	team.sort()
	for j in range(len(team) - 1):
		if team[j + 1] - team[j] <= 1:
			num = 2
			break
	print(num)


t = int(input())
l2 = []
for i1 in range(t):
	n = int(input())
	l1 = [int(a) for a in input().split()]
	flag = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			c = max(l1[i], l1[j])
			if c - l1[i] == 1 or c - l1[j] == 1:
				flag = 1
				break
		if flag == 1:
			break
		else:
			continue
	if flag == 1:
		l2.append(2)
	else:
		l2.append(1)
for i in range(t):
	print(l2[i])


def main():
	testcase = int(input())
	result = []
	for i in range(testcase):
		contestant_num = int(input())
		contestant = list(map(int, input().split()))
		if contestant_num == 2:
			if abs(contestant[0] - contestant[1]) == 1:
				result.append(2)
			else:
				result.append(1)
		elif contestant_num == 1:
			result.append(1)
		else:
			flag = True
			contestant.sort()
			for i in range(contestant_num - 1):
				if abs(contestant[i] - contestant[i + 1]) <= 1:
					flag = False
			if flag:
				result.append(1)
			else:
				result.append(2)
	for i in result:
		print(i)
main()


ntest = int(input())
for i in range(ntest):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	count = 0
	for i in range(n - 1):
		if arr[i + 1] == arr[i] + 1:
			count = 1
			break
	if count == 1:
		print(2)
	else:
		print(1)


import sys

def atoi(line):
	line = line.rstrip().split()
	return list(map(int, line))
q = int(input())
ans = [0] * q
for q_ in range(q):
	n = int(input())
	a = atoi(sys.stdin.readline())
	rest = []
	a.sort()
	ct = 1
	while True:
		for i in range(len(a) - 1):
			if abs(a[i] - a[i + 1]) == 1:
				rest.append(a[i])
		if len(rest):
			ct += 1
			a = rest
			del rest[:]
		else:
			break
	ans[q_] = ct
print(*ans, sep='\n')


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	f = 1
	for i in range(n - 1):
		if abs(a[i + 1] - a[i]) == 1:
			f += 1
	print(1) if f == 1 else print(2)


q = int(input())
for i in range(q):
	n = int(input())
	mas = list(map(int, input().split()))
	mas.sort()
	kol = 0
	while mas != []:
		kol += 1
		ans = []
		p = mas[0]
		for i in range(1, len(mas)):
			if mas[i] > p + 1:
				p = mas[i]
			else:
				ans.append(mas[i])
		mas = ans
	print(kol)


for _ in range(int(input())):
	n = int(input())
	arr = list(sorted(set([int(x) for x in input().split()])))
	(ans, ind) = (1, 0)
	while ind + 1 < len(arr):
		if arr[ind + 1] - arr[ind] == 1:
			ans = 2
			break
		ind += 1
	print(ans)


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	b = True
	for j in range(n):
		if abs(arr[j - 1] - arr[j]) == 1:
			print(2)
			b = False
			break
	if b == True:
		print(1)


for _ in range(int(input())):
	num = int(input())
	seq = list(map(int, input().split()))
	even = []
	odd = []
	seq.sort()
	if num == 1:
		print(1)
	else:
		ans = 1
		for i in seq:
			if i % 2 == 0:
				even.append(i)
			else:
				odd.append(i)
		for i in even:
			if i - 1 in odd or i + 1 in odd:
				ans += 1
				break
		print(ans)


import math
q = int(input())
for _ in range(q):
	n = int(input())
	s = [int(x) for x in input().split()]
	cnt = [0] * n
	teams = 1
	s.sort()
	for i in range(n - 1):
		for j in range(i + 1, n):
			k = abs(s[i] - s[j])
			if k == 1:
				cnt[j] = -1
	count = cnt.count(-1)
	if count == 0:
		teams = 1
	else:
		teams += 1
	print(teams)


def solve(students):
	students.sort()
	for i in range(len(students) - 1):
		if abs(students[i] - students[i + 1]) == 1:
			return 2
	return 1
t = int(input())
for i in range(t):
	n = int(input())
	print(solve([int(x) for x in input().split()]))


def need_two_set(a):
	for b in a:
		if a.count(b - 1) != 0 or a.count(b + 1) != 0:
			return True
	return False
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if need_two_set(a):
		print(2)
	else:
		print(1)


from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 7)

def iin():
	return int(stdin.readline())

def lin():
	return list(map(int, stdin.readline().split()))

def main():
	t = iin()
	while t:
		t -= 1
		n = iin()
		a = lin()
		a.sort()
		ans = 1
		for i in range(1, n):
			if a[i] - a[i - 1] == 1:
				ans += 1
				break
		print(ans)
main()


a = int(input())
for i in range(a):
	n = int(input())
	b = []
	k = 0
	n1 = input().split(' ')
	for j in n1:
		b.append(int(j))
	b.sort()
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] <= 1:
			k += 1
	if k > 0:
		print(2)
	else:
		print(1)


m = int(input())
liste = []
for i in range(m):
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	a.sort()
	h = 0
	for j in range(1, len(a)):
		if a[j] - a[j - 1] == 1:
			liste.append(2)
			h += 1
			break
	if h == 0:
		liste.append(1)
for i in liste:
	print(i)


q = int(input())
for i in range(q):
	n = int(input())
	count = 1
	p = list(map(int, input().split()))
	p.sort()
	for i in range(n - 1):
		if abs(p[i] - p[i + 1]) == 1:
			count = 2
			break
	print(count)


q = int(input())
for i in range(q):
	n = int(input())
	s = sorted(list(map(int, input().split())))
	if n == 1:
		print(1)
		continue
	nearby = False
	for i in range(1, n):
		if s[i] - s[i - 1] == 1:
			nearby = True
	if nearby:
		print(2)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	A = sorted(list(map(int, input().split())))
	c = 0
	for i in range(1, n):
		if A[i - 1] == A[i] - 1:
			c = 1
			break
	print(c + 1)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 1
	for i in a:
		if i + 1 in a:
			c = 2
	print(c)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
from collections import *

def li():
	return [int(____) for ____ in input().rstrip('\n').split(' ')]

def val():
	return int(input().rstrip('\n'))

def st():
	return input().rstrip('\n')

def sttoli():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	l = li()
	l.sort()
	a = []
	b = []
	a.append(l[0])
	for i in range(1, n):
		if abs(a[-1] - l[i]) == 1:
			b.append(l[i])
		else:
			a.append(l[i])
	print(1 + (1 if len(b) else 0))


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = True
	for j in range(1, len(a)):
		if a[j] == a[j - 1] + 1:
			print(2)
			flag = False
			break
	if flag:
		print(1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = input().split()
	for i in range(n):
		arr[i] = int(arr[i])
	arr.sort
	ans = 1
	for i in range(0, n - 1):
		for j in range(i + 1, n):
			if abs(arr[j] - arr[i]) <= 1:
				ans = 2
				break
	print(ans)


tc = int(input())
for _ in range(tc):
	p = int(input())
	q = [int(i) for i in input().split()]
	q.sort()
	flag = 0
	for i in range(p - 1):
		if q[i + 1] - q[i] <= 1:
			flag = 1
	if flag == 1:
		count = 2
	else:
		count = 1
	print(count)


q = int(input())
c = 1
for i in range(q):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	l = len(a)
	if l == 1:
		print(1)
		continue
	a.append(0)
	for i in range(0, l - 1):
		x = abs(a[i + 1] - a[i])
		if x == 1:
			c = 2
			break
	print(c)
	c = 1


tests = int(input())
for _ in range(tests):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	maximum = 1
	maximum_range = 1
	for i in range(1, n):
		if arr[i] == arr[i - 1] + 1:
			maximum_range += 1
		else:
			maximum = max(maximum_range, maximum)
			maximum_range = 1
	maximum = max(maximum_range, maximum)
	print(2 if maximum >= 2 else 1)


def min_pairs(n, students):
	groups = 1
	students = sorted(students)
	for i in range(1, n):
		if students[i] - students[i - 1] == 1:
			groups = 2
			break
	return groups
q = int(input())
for _ in range(q):
	n = int(input())
	students = list(map(int, input().split()))
	print(min_pairs(n, students))


t = int(input())
for _ in range(t):
	number = int(input())
	values = list(map(int, input().split()))
	values.sort()
	if len(values) == 2:
		if abs(values[0] - values[1]) == 1:
			print(2)
		else:
			print(1)
	elif len(values) == 1:
		print(1)
	else:
		count = 0
		for i in range(len(values) - 1):
			if abs(values[i] - values[i + 1]) == 1:
				count += 1
		if count > 0:
			print(2)
		else:
			print(1)


i = int
cin = input

def solve(r, arr):
	arr.sort()
	for j in range(r - 1):
		if abs(arr[j] - arr[j + 1]) == 1:
			return 2
	return 1
for _ in range(i(cin())):
	r = i(cin())
	arr = list(map(i, cin().split()))
	print(solve(r, arr))


def main():
	n = int(input())
	for i in range(n):
		r = int(input())
		data = [int(v) for v in input().split()]
		data.sort()
		found = False
		for j in range(r - 1):
			if data[j] + 1 == data[j + 1]:
				found = True
		if found:
			print(2)
		else:
			print(1)
main()


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter

def pow(a, b):
	if b == 0:
		return 1
	else:
		val = pow(a, int(b / 2))
		if b % 2 == 0:
			return val * val
		elif b > 0:
			return a * val * val
		else:
			return val * val // a
t = int(input())
for i in range(t):
	n = int(input())
	l = []
	s = input().split(' ')
	for j in range(n):
		l.append(int(s[j]))
	l.sort()
	boo = 1
	for j in range(n - 1):
		if l[j] + 1 == l[j + 1]:
			boo = -1
			break
	if boo == 1:
		print(1)
	else:
		print(2)


import math
import sys
from collections import defaultdict, Counter
from itertools import groupby
rt = lambda : map(int, input().split())
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))

def main():
	q = ri()
	for _ in range(q):
		n = ri()
		a = rl()
		a.sort()
		x = False
		for i in range(n - 1):
			if a[i + 1] == a[i] + 1:
				x = True
				break
		print(2 if x else 1)
main()


q = int(input())
for _ in range(q):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	ans = 0
	while len(arr) != 0:
		team = [arr[0]]
		arr = arr[1:]
		i = 0
		while i < len(arr):
			if abs(team[-1] - arr[i]) != 1:
				team.append(arr[i])
				arr = arr[:i] + arr[i + 1:]
			else:
				i += 1
		ans += 1
	print(ans)


q = int(input())

def teams(a, n):
	if len(a) == 1:
		return 1
	for j in range(n - 1):
		if a[j + 1] - a[j] == 1:
			return 2
	return 1
for i in range(q):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	print(teams(a, n))


t = int(input())
num = list()
student = list()
for j in range(t):
	num.append(list(map(int, input().split())))
	student.append(list(map(int, input().split())))
for j in range(t):
	new = sorted(student[j])
	n = num[j][0]
	count = list()
	tot = list()
	for i in range(n - 1):
		if abs(new[i] - new[i + 1]) > 1:
			continue
		else:
			if len(count) == 0:
				count.append(1)
			if all((abs(x - new[i + 1]) > 1 for x in tot)):
				tot.append(new[i + 1])
			elif new[i] not in tot:
				count.append(1)
	print(len(count) + 1)


a = int(input())
for i in range(a):
	b = int(input())
	l = list(map(int, input().split()))
	ans = 0
	m = 0
	for j in range(len(l)):
		m = 1
		for k in range(len(l)):
			if abs(l[k] - l[j]) == 1:
				m += 1
		if m > ans:
			ans = m
	if ans == 1:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	arr = [int(k) for k in input().split()]
	arr.sort()
	counter = 0
	for i in range(1, n):
		if arr[i] - arr[i - 1] == 1:
			counter = 1
			break
		else:
			continue
	if counter == 1:
		print(2)
	else:
		print(1)


for test in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	cnt = 1
	ans = 0
	for i in range(1, len(a)):
		if a[i] == a[i - 1]:
			continue
		elif abs(a[i] - a[i - 1]) == 1:
			cnt += 1
		else:
			ans = max(cnt, ans)
			cnt = 1
		ans = max(cnt, ans)
	print(2 if ans > 1 else 1)


for _ in range(int(input())):
	n = int(input())
	flag = 0
	l = [int(x) for x in input().split()]
	for i in l:
		if i + 1 in l or i - 1 in l:
			flag = 1
			break
		else:
			continue
	if flag == 1:
		print(2)
	else:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	a.sort()
	op = 0
	for j in range(n):
		x = 0
		k = 0
		while k < n:
			if j == k:
				k += 1
				continue
			c = 0
			while k < n and abs(a[j] - a[k]) <= 1:
				c += 1
				k += 1
			k += 1
			x = max(x, c // 2)
		op = max(op, x)
	print(op + 1)


n = int(input())
for i in range(n):
	a = int(input())
	b = sorted(list(map(int, input().split())))
	if a == 1:
		print(1)
	else:
		for i in range(1, a):
			if b[i] - b[i - 1] == 1:
				print(2)
				break
		else:
			print(1)


import math

def Solve():
	A = []
	testcase = int(input(), 10)
	for i in range(0, testcase):
		lst = []
		flag = False
		sizelist = int(input(), 10)
		lst = list(map(int, input().split()))
		lst.sort()
		for j in range(1, len(lst)):
			if abs(lst[j - 1] - lst[j]) == 1:
				flag = True
		if flag == True:
			A.append(2)
		else:
			A.append(1)
	return A
A = Solve()
for i in A:
	print(i)


from sys import stdin
q = int(stdin.readline())
for i in range(q):
	n = int(stdin.readline())
	arr = sorted(list(map(int, stdin.readline().split())))
	cond = True
	for i in range(n):
		for j in range(i + 1, n):
			if abs(arr[i] - arr[j]) <= 1:
				cond = False
				break
			else:
				pass
		if cond == True:
			pass
		else:
			break
	if cond == True:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for (x, y) in zip(a, a[1:]):
		if y - x == 1:
			ans = 2
			break
	print(ans)


tc = int(input())
while tc > 0:
	tc -= 1
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	val = False
	for i in range(0, len(s) - 1):
		if s[i + 1] - s[i] == 1:
			val = True
	print(2 if val else 1)


q = int(input())
for i in range(q):
	n = int(input())
	a = [int(x) for x in input().split()][:n]
	a.sort()
	m = [a[0]]
	c = 1
	for j in range(1, len(a)):
		found = False
		for k in range(len(m)):
			if a[j] - m[k] > 1:
				m[k] = a[j]
				found = True
				break
		if not found:
			m.append(a[j])
	print(len(m))


from sys import stdin
q = int(stdin.readline())
for i in range(q):
	ans = 1
	n = int(stdin.readline())
	skills = [int(x) for x in stdin.readline().split()]
	for j in range(len(skills)):
		for k in range(j + 1, len(skills)):
			if abs(skills[k] - skills[j]) == 1:
				ans = 2
				break
	print(ans)


q = int(input())
while q:
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr = sorted(arr)
	if n == 1:
		print(1)
	else:
		flag = 0
		for i in range(len(arr) - 1):
			if abs(arr[i] - arr[i + 1]) == 1:
				flag = 0
				print(2)
				break
			else:
				flag = 1
		if flag == 1:
			print(1)
	q = q - 1


for z in range(int(input())):
	n = int(input())
	ll = list(map(int, input().split()))
	ll.sort()
	flg = True
	for i in range(len(ll) - 1):
		if ll[i] + 1 == ll[i + 1]:
			flg = False
			break
	print(1) if flg else print(2)