A particular month has 30 days, numbered from 1 to 30.

Day 1 is a Monday, and the usual 7-day week is followed (so day 2 is Tuesday, day 3 is Wednesday, and so on).

Every Saturday and Sunday is a holiday. There are N festival days, which are also holidays. Note that it is possible for a festival day to occur on a Saturday or Sunday.

You are given the dates of the festivals. Determine the total number of holidays in this month.

------ Input Format ------ 

- The first line of input contains a single integer T, denoting the number of test cases. The description of T test cases follows.
- The first line of each test case contains an integer N denoting the number of festival days.
- The second line of each test case contains N distinct space-separated integers A_{1}, A_{2}, \ldots A_{N}, denoting the festival days. Note that the A_{i} are not necessarily given in sorted order.

------ Output Format ------ 

For each test case, output a new line containing the total number of holidays.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ N ≤ 30$
$1 ≤ A_{i} ≤ 30$
- All the $A_{i}$ are distinct

----- Sample Input 1 ------ 
3
2
5 7
3
23 1 6
1
13

----- Sample Output 1 ------ 
9
10
8

----- explanation 1 ------ 
Test Case $1$: Days $6, 13, 20$ and $27$ are Saturdays, and days $7, 14, 21, 28$ are Sundays. The festivals fall on day $5$ and day $7$, but day $7$ is already a Sunday. This gives us $9$ holidays in total — days $5, 6, 7, 13, 14, 20, 21, 27, 28$.

Test Case $2$: Days $6, 13, 20$ and $27$ are Saturdays, and days $7, 14, 21, 28$ are Sundays. The festivals fall on day $1$, day $6$, and day $23$. This gives us $10$ holidays in total — days $1, 6, 7, 13, 14, 20, 21, 23, 27, 28$.

Test Case $3$: Days $6, 13, 20$ and $27$ are Saturdays, and days $7, 14, 21, 28$ are Sundays. The only festival is on day $13$, which is already a holiday. This gives us $8$ holidays in total — days $6, 7, 13, 14, 20, 21, 27, 28$.

Difficulty: EASY

Solutions:
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count = 8
	for i in a:
		if i not in [6, 7, 13, 14, 20, 21, 27, 28]:
			count = count + 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	x = [int(x) for x in input().split()]
	s = 8
	for i in x:
		if i in [6, 7, 13, 14, 20, 21, 27, 28]:
			pass
		else:
			s += 1
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	h = [6, 13, 20, 27, 7, 14, 21, 28]
	c = 0
	for i in a:
		if i not in h:
			c = c + 1
	print(c + len(h))


for i in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	Holiday = [6, 7, 13, 14, 20, 21, 27, 28]
	count = len(Holiday)
	for ele in L:
		if ele not in Holiday:
			count += 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	holiday = 8
	day = list(map(int, input().split()))
	for i in day:
		if i % 7 != 6 and i % 7 != 0:
			holiday += 1
	print(holiday)


tc = int(input())
for i in range(tc):
	n = int(input())
	hd = list(map(int, input().split()))
	weekend = [6, 13, 20, 27, 7, 14, 21, 28]
	total_hd = 8
	for j in range(n):
		if hd[j] not in weekend:
			total_hd += 1
		else:
			pass
	print(total_hd)


for i in range(int(input())):
	n = int(input())
	l = set(map(int, input().split()))
	hol = {6, 7, 13, 14, 20, 21, 27, 28}
	print(len(l | hol))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	holi = [6, 13, 20, 27, 7, 14, 21, 28]
	for i in a:
		if i not in holi:
			holi.append(i)
	print(len(holi))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	sl = [6, 7, 13, 14, 20, 21, 27, 28]
	c = 0
	for j in l:
		if j not in sl:
			c += 1
	print(8 + c)


n = int(input())
for _ in range(n):
	N = int(input())
	A = list(map(int, input().split()))
	dates = [6, 7, 13, 14, 20, 21, 27, 28]
	holidays = len(dates)
	for date in A:
		if date not in dates:
			holidays += 1
	print(holidays)


for i in range(int(input())):
	N = int(input())
	l = list(map(int, input().split()))
	l1 = [6, 13, 20, 27, 7, 14, 21, 28]
	count = 8
	for i in l:
		if i not in l1:
			count += 1
		else:
			pass
	print(count)


for i in range(int(input())):
	n = int(input())
	dates = list(map(int, input().split(' ')))
	holidays = 8
	hlist = [6, 7, 13, 14, 20, 21, 27, 28]
	for i in dates:
		if i in hlist:
			holidays = holidays + 0
		else:
			holidays = holidays + 1
	print(holidays)


for i in range(int(input())):
	b = int(input())
	l = list(map(int, input().split()))
	count = 8
	for j in l:
		if j not in [6, 7, 13, 14, 20, 21, 27, 28]:
			count += 1
	print(count)


for i in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	c = 0
	l2 = [6, 13, 20, 27, 7, 14, 21, 28]
	for i in l1:
		if i not in l2:
			c += 1
	print(len(l2) + c)


T = int(input())
for _ in range(T):
	N = int(input())
	holidays = [int(i) for i in input().split()][0:N]
	holidays.sort(reverse=False)
	sat_sun = [6, 7, 13, 14, 20, 21, 27, 28]
	initial_count = len(sat_sun)
	count_holidays = 0
	for e in holidays:
		if e in sat_sun:
			pass
		else:
			count_holidays += 1
	print(initial_count + count_holidays)


n = int(input())
for i in range(n):
	a = int(input())
	m = list(map(int, input().split()))
	satsun = [6, 13, 20, 27, 7, 14, 21, 28]
	not_sunsat = list(filter(lambda x: x not in satsun, m))
	print(8 + len(not_sunsat))


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	for i in range(1, 31):
		if (i % 7 == 0 or i % 7 == 6) and i not in l:
			c += 1
	print(c + n)


def code():
	cases = int(input())
	for _ in range(cases):
		N = int(input())
		festival_days = list(map(int, input().split(' ')))
		sats = [6, 13, 20, 27]
		suns = [7, 14, 21, 28]
		total_holidays = 0
		for day in festival_days:
			if day not in sats and day not in suns:
				total_holidays += 1
		total_holidays += len(sats) + len(suns)
		print(total_holidays)
code()


T = int(input())
for i in range(T):
	N = int(input())
	holidays = list(map(int, input().split()))
	noOfHolidays = 8
	for i in range(N):
		if holidays[i] % 7 != 0 and (holidays[i] + 1) % 7 != 0:
			noOfHolidays += 1
	print(noOfHolidays)


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	c = 0
	for i in a:
		if int(i) % 7 == 6 or int(i) % 7 == 0:
			continue
		else:
			c += 1
	print(8 + c)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = [6, 13, 20, 27, 7, 14, 21, 28]
	b = 8
	for i in a:
		if i not in c:
			b += 1
	print(b)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	h = [6, 7, 13, 14, 20, 21, 27, 28]
	d = 8
	for j in a:
		if j not in h:
			d += 1
	print(d)


n = int(input())
for _ in range(n):
	n1 = int(input())
	a = list(map(int, input().split()))
	c = 0
	for i in a:
		if i == 6 or i == 13 or i == 20 or (i == 27) or (i == 7) or (i == 14) or (i == 21) or (i == 28):
			c += 0
		else:
			c += 1
	print(c + 8)


T = int(input())
for i in range(T):
	N = int(input())
	N1 = list(map(int, input().split()))
	n2 = [6, 7]
	n3 = 6
	n4 = 7
	n5 = 8
	while n3 < 28 and n4 < 28:
		n3 += 7
		n4 += 7
		n2.append(n3)
		n2.append(n4)
	for i in N1:
		if i not in n2:
			n5 += 1
	print(n5)


n = int(input())
for i in range(n):
	x = int(input())
	k = list(map(int, input().split()))
	sat = [6, 13, 20, 27]
	sun = [7, 14, 21, 28]
	print(len(set(k + sat + sun)))


wkd = 0
for i in range(1, 31):
	if i % 7 == 0 or i % 7 == 6:
		wkd += 1
t = int(input())
for j in range(t):
	t = -1
	hol = wkd
	n = int(input())
	l = list(map(int, input().split()))
	for i in l:
		if i % 7 != 0 and i % 7 != 6:
			hol += 1
	print(hol)


t = int(input())
for i in range(t):
	N = int(input())
	A = list(map(int, input().split()))
	weekend = [6, 7, 13, 14, 20, 21, 27, 28]
	overall = A + weekend
	overall_unique = list(set(overall))
	print(len(overall_unique))


for tc in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	S = [6, 7, 13, 14, 20, 21, 27, 28]
	count = 8
	for i in range(len(A)):
		if A[i] not in S:
			count += 1
	print(count)


t = int(input())
for i in range(t):
	N = int(input())
	l = list(map(int, input().split()))
	l1 = [6, 13, 20, 27, 7, 14, 21, 28]
	c = 8
	for i in l:
		if i not in l1:
			c += 1
	print(c)


test = int(input())
for i in range(test):
	n = int(input())
	l = list(map(int, input().split()))
	x = [6, 7, 13, 14, 20, 21, 27, 28]
	c = len(x)
	for i in l:
		if i not in x:
			c = c + 1
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	for k in range(n):
		if l[k] == 6 or l[k] == 13 or l[k] == 20 or (l[k] == 27) or (l[k] == 7) or (l[k] == 14) or (l[k] == 21) or (l[k] == 28):
			c = c + 0
		else:
			c = c + 1
	print(8 + c)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	t = 0
	for j in range(n):
		if a[j] == 6 or a[j] == 13 or a[j] == 20 or (a[j] == 27) or (a[j] == 7) or (a[j] == 14) or (a[j] == 21) or (a[j] == 28):
			t = t + 0
		else:
			t = t + 1
	print(8 + t)


for x in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	m1 = [6, 7, 13, 14, 20, 21, 27, 28]
	s = 0
	for y in m:
		if y in m1:
			continue
		else:
			s = s + 1
	print(len(m1) + s)


T = int(input())
for i in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	s = [6, 13, 20, 27, 7, 14, 21, 28]
	count = 8
	for i in a:
		if i not in s:
			count += 1
		else:
			pass
	print(count)


for _ in range(int(input())):
	f_day = int(input())
	f_list = list(map(int, input().split()))
	f_list = sorted(f_list)
	extra = 0
	weekends = 8
	weekend_list = [6, 7, 13, 14, 20, 21, 27, 28]
	for i in f_list:
		if i not in weekend_list:
			extra += 1
	print(weekends + extra)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = [6, 7, 13, 14, 20, 21, 27, 28]
	count = 0
	for i in range(0, n):
		if a[i] in c:
			continue
		else:
			count += 1
	print(len(c) + count)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = 8
	for i in l:
		if i % 7 == 0 or (i + 1) % 7 == 0:
			c = c
		else:
			c += 1
	print(c)


T = int(input())
for _ in range(T):
	N = int(input())
	A = map(int, input().split())
	sat_sun = [6, 7, 13, 14, 20, 21, 27, 28]
	for i in A:
		if i not in sat_sun:
			sat_sun.append(i)
	print(len(sat_sun))


for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	days = [6, 13, 20, 27, 7, 14, 21, 28]
	n = 0
	y = b + days
	for i in y:
		if y.count(i) >= 2:
			n += 1
	print(int(len(y) - n / 2))


for i in range(int(input())):
	holiday = 8
	weekend = [6, 7, 13, 14, 20, 21, 27, 28]
	festivals = int(input())
	festival_days = list(map(int, input().split()))
	festival_days = sorted(festival_days)
	for i in festival_days:
		if i not in weekend:
			holiday += 1
	print(holiday)


t = int(input())
for j in range(t):
	a = int(input())
	s = 8
	c = 0
	ch = [6, 7, 13, 14, 20, 21, 27, 28]
	l = list(map(int, input().split()))
	for k in range(a):
		if l[k] in ch:
			c = c + 1
	if c == len(l):
		print(s)
	else:
		print(s + len(l) - c)


for i in range(int(input())):
	fest = []
	numD = int(input())
	fest.extend(map(int, input().split(' ')))
	for a in range(6, 30, 7):
		if a not in fest:
			fest.append(a)
		if a + 1 not in fest and a + 1 <= 30:
			fest.append(a + 1)
	print(len(fest))


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	count = 8
	for i in a:
		if i % 7 != 6 and i % 7 != 0:
			count += 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	l = [6, 7, 13, 14, 20, 21, 27, 28]
	for i in range(n):
		if s[i] in l:
			n -= 1
	print(n + 8)


t = int(input())
for i in range(t):
	a = int(input())
	b = list(map(int, input().split()))
	h = 8
	for j in range(a):
		if (b[j] - 6) % 7 != 0 and b[j] % 7 != 0:
			h += 1
	print(h)


t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	B = [6, 13, 20, 27, 7, 14, 21, 28]
	holidays = 8
	for j in A:
		if j not in B:
			holidays += 1
		else:
			continue
	print(holidays)


for _ in range(int(input())):
	n = int(input())
	t1 = 8
	t = [int(i) for i in input().split()]
	l = [6, 13, 20, 27, 7, 14, 21, 28]
	for i in range(n):
		if t[i] not in l:
			t1 += 1
	print(t1)


T = int(input())
for i in range(T):
	N = int(input())
	A = list(map(int, input().split(' ')))
	B = [6, 13, 20, 27, 7, 14, 21, 28]
	count = len(B)
	for j in A:
		if j not in B:
			count = count + 1
	print(count)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	b = 30 // 7 * 2
	for i in range(n):
		if a[i] == 6 or a[i] == 7 or a[i] == 13 or (a[i] == 14) or (a[i] == 20) or (a[i] == 21) or (a[i] == 27) or (a[i] == 28):
			c += 1
	print(b + (n - c))


for i in range(int(input())):
	n = int(input())
	fest = list(map(str, input().split()))
	sat = ('6', '13', '20', '27', '7', '14', '21', '28')
	c = 0
	for i in fest:
		if i not in sat:
			c = c + 1
	s = 8 + c
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	k = list(map(int, input().split()))
	h = [6, 13, 20, 27, 7, 14, 21, 28]
	for i in k:
		if i not in h:
			h.append(i)
	print(len(h))


t = int(input())
for i in range(t):
	x = int(input())
	l = list(map(int, input().split()))
	y = [6, 13, 20, 27, 7, 14, 21, 28]
	print(len(set(y + l)))


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	c = [6, 13, 20, 27, 7, 14, 21, 28]
	cnt = 8
	for i in range(len(l)):
		if l[i] not in c:
			cnt += 1
	print(cnt)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	hol = [6, 7, 13, 14, 20, 21, 27, 28]
	print(len(set(arr + hol)))


t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	B = [6, 13, 20, 27, 7, 14, 21, 28]
	z = len(B)
	count = 0
	for j in A:
		if j not in B:
			count += 1
	print(z + count)


for i in range(0, int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	y = [6, 13, 20, 27, 7, 14, 21, 28]
	z = len(y)
	c = 0
	for j in x:
		if j not in y:
			c = c + 1
	print(c + z)


for i in range(int(input())):
	fest = int(input())
	fest_days = list(map(int, input().split()))
	li = [6, 13, 20, 27, 7, 14, 21, 28]
	ct = 8
	for i in fest_days:
		if i not in li:
			ct += 1
	print(ct)


for i in range(int(input())):
	Number_of_fest = int(input())
	second_line_of_input = list(map(int, input().split()))
	list1 = [6, 13, 20, 27, 7, 14, 21, 28]
	count = 8
	for i in second_line_of_input:
		if i not in list1:
			count += 1
	print(count)


number_of_testcases = int(input())
for _ in range(number_of_testcases):
	festival_days = int(input())
	l = list(map(int, input().split()))
	count = 8
	leave_days = [6, 7, 13, 14, 20, 21, 27, 28]
	for var in l:
		if var not in leave_days:
			leave_days.append(var)
			count = count + 1
	print(count)