Dima and his friends have been playing hide and seek at Dima's place all night. As a result, Dima's place got messy. In the morning they decided that they need to clean the place.

To decide who exactly would clean the apartment, the friends want to play a counting-out game. First, all the guys stand in a circle, and then each of them shows some number of fingers on one hand (one to five), and then the boys count in a circle, starting from Dima, the number of people, respective to the total number of fingers shown. The person on who the countdown stops will clean the apartment.

For example, if Dima and one of his friends played hide and seek, and 7 fingers were shown during the counting-out, then Dima would clean the place. If there were 2 or say, 8 fingers shown, then his friend would clean the place.

Dima knows how many fingers each of his friends will show during the counting-out. Now he is interested in the number of ways to show some number of fingers on one hand (one to five), so that he did not have to clean the place. Help Dima.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 100) — the number of Dima's friends. Dima himself isn't considered to be his own friend. The second line contains n positive integers, not exceeding 5, representing, how many fingers the Dima's friends will show. 

The numbers in the lines are separated by a single space.


-----Output-----

In a single line print the answer to the problem.


-----Examples-----
Input
1
1

Output
3

Input
1
2

Output
2

Input
2
3 5

Output
3



-----Note-----

In the first sample Dima can show 1, 3 or 5 fingers. If Dima shows 3 fingers, then the counting-out will go like that: Dima, his friend, Dima, his friend.

In the second sample Dima can show 2 or 4 fingers.

Difficulty: EASY
Tags: Mathematics

Implementation

Starter code:

Solutions:
(n, c) = (int(input()) + 1, 0)
l = sum(list(map(int, input().split())))
for i in range(1, 6):
	if (l + i) % n != 1:
		c += 1
print(c)


n = int(input()) + 1
c = 5
a = sum(list(map(int, input().split())))
for i in range(1, 6):
	if (a + i) % n == 1:
		c = c - 1
print(c)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict

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

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

def I():
	return int(stdin.readline())
P = 1000000007
n = I()
lis = L()
sm = sum(lis)
c = 0
for i in range(1, 6):
	if (sm + i) % (n + 1) != 1:
		c += 1
print(c)


def main():
	n_friends = int(input())
	count = sum([int(_) for _ in input().split()])
	remainder = count % (n_friends + 1)
	count_ways = sum(((remainder + i) % (n_friends + 1) != 1 for i in range(1, 6)))
	print(count_ways)
main()


n = int(input())
s = sum(map(int, input().split()))
x = 0
for i in range(6):
	if i != 0 and (s + i) % (n + 1) != 1:
		x += 1
print(x)


n = int(input())
s = sum(map(int, input().split())) % (n + 1)
c = 0
for i in range(1, 6):
	if (s + i) % (n + 1) != 1:
		c += 1
print(c)


def main():
	n = int(input())
	arr = [int(x) for x in input().split()]
	SUM = sum(arr)
	ways = 0
	for i in range(1, 6):
		if (SUM + i) % (n + 1) != 1:
			ways += 1
	print(ways)
	return
main()


n = int(input())
a = sum(list(map(int, input().split())))
s = 0
for x in range(1, 6):
	if (a + x) % (n + 1) != 1:
		s += 1
print(s)


n = int(input())
n += 1
arr = list(map(int, input().split()))
summation = sum(arr)
count = 0
for i in range(1, 6):
	if (summation + i) % n == 1:
		pass
	else:
		count += 1
print(count)


n = int(input())
arr = list(map(int, input().split()))
count = 0
for x in arr:
	count += x
ans = 0
for i in range(5, 0, -1):
	if (count + i) % (n + 1) != 1:
		ans += 1
print(ans)


num = int(input())
count = 0
ppl = num + 1
y = input()
x = y.split()
for i in range(0, num):
	x[i] = int(x[i])
total = sum(x)
for i in range(1, 6):
	if (total + i) % ppl != 1:
		count += 1
print(count)


def main():
	n = int(input().strip()) + 1
	x = sum(map(int, input().strip().split())) % n
	return sum(((x + i) % n != 1 for i in range(1, 6)))
print(main())


n = int(input())
ans = 0
l = [int(x) for x in input().split()]
x = n + 1
y = sum(l)
for i in range(1, 6):
	if (y + i) % x != 1:
		ans += 1
print(ans)


friends = int(input()) + 1
fingers = sum((int(i) for i in input().split()))
ways = 0
for i in range(1, 6):
	if (i + fingers) % friends != 1:
		ways += 1
print(ways)


n = int(input())
s = sum([int(i) for i in input().split()])
print(sum([(s + i) % (n + 1) != 1 for i in range(1, 6)]))


n = int(input())
l = list(map(int, input().split()))
if n < 3:
	if n % 2 == 0:
		if sum(l) % 2 == 0:
			print(3)
		else:
			print(2)
	elif sum(l) % 2 == 0:
		print(2)
	else:
		print(3)
else:
	s = sum(l) % (n + 1)
	s = n + 1 - s
	if s >= 5:
		print(5)
	else:
		print(4)


n = int(input())
l = map(int, input().split())
s = sum(l)
count = 0
for i in range(1, 6):
	mod = (s + i) % (n + 1)
	if mod != 1:
		count += 1
print(count)


n = int(input()) + 1
summa = sum(map(int, input().split()))
k = 0
for i in range(1, 6):
	if (summa + i) % n != 1:
		k += 1
print(k)


def main():
	g = int(input())
	list_fingers = list(map(int, input().split()))
	sum_fingers = sum(list_fingers)
	current_count = 0
	for i in range(1, 6):
		if (i + sum_fingers) % (g + 1) == 1:
			continue
		else:
			current_count += 1
	print(current_count)
main()


n = int(input())
l = sum(map(int, input().split()))
ans = 0
for i in range(1, 6):
	if (l + i) % (n + 1) != 1:
		ans += 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
l1 = [1, 2, 3, 4, 5]
sm = sum(l)
no = 0
for i in l1:
	s = sm + i
	if s % (n + 1) != 1:
		no += 1
print(no)


even = 2
odd = 3
no_friends = int(input()) + 1
people = [-1] * no_friends
fingers_count = [int(x) for x in input().split()]
total = sum(fingers_count)
ans = 0
for j in range(1, 6):
	temp = total
	temp += j
	i = 0
	k = 0
	count = 1
	while i < temp:
		if i == len(people) * count:
			count += 1
			k = 0
			i += 1
			continue
		k += 1
		i += 1
	if k != 0:
		ans += 1
print(ans)


3
n = int(input())
s = sum(map(int, input().split()))
ans = 0
for i in range(1, 6):
	ans += (s + i) % (n + 1) != 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
r = sum(a) % (n + 1)
ans = 0
for i in range(1, 6):
	if (r + i) % (n + 1) == 1:
		ans -= 1
print(ans + 5)


n = int(input())
s = input()
s = s.split(' ')
k = 0
for x in s:
	k = k + int(x)
n = n + 1
k = k % n
total = 0
for i in range(5):
	t = k + i + 1
	t = t % n
	if t != 1:
		total = total + 1
print(total)


friend = int(input()) + 1
result = list(map(int, input().split()))
result = sum(result)
count = 0
for i in range(1, 6):
	if (result + i) % friend - 1 != 0:
		count += 1
print(count)


from typing import Counter
n = int(input())
l = list(map(int, input().split()))
total = sum(l)
c = 0
for i in range(1, 6):
	if (total + i) % (n + 1) != 1:
		c += 1
print(c)


n = int(input())
s = sum(map(int, input().split()))
t = 0
for x in range(1, 6):
	if (x + s) % (n + 1) - 1 != 0:
		t += 1
print(t)


n = int(input())
j = n + 1
f = []
x = 0
e = 0
i = 0
c = input().split()
while i < n:
	w = c[i]
	e = int(w)
	x = x + e
	i = i + 1
k = x
if x != j:
	while x >= j:
		x = x - j
m = 0
h = 0
u = []
p = 0
s = 0
while s < 5:
	m = x + s
	u.append(m)
	h = int(u[s])
	if h > j:
		h = h - p * j
	if h == j:
		p = p + 1
	s = s + 1
print(s - p)


friends = int(input())
lst = []
lst = [int(x) for x in input().split()]
sum = 0
for i in range(len(lst)):
	sum += lst[i]
lst = []
i = 1
while i < sum + 6:
	lst.append('d')
	for j in range(friends):
		if len(lst) != sum + 5:
			lst.append('f')
		i = i + 1
	i = i + 1
count = 0
for i in range(sum, len(lst)):
	if lst[i] == 'f':
		count += 1
print(count)


n = int(input())
s = sum(map(int, input().split())) % (n + 1)
cnt = sum([1 for i in range(5) if (i + 1 + s) % (n + 1) != 1])
print(cnt)


n = int(input()) + 1
sum_l = sum(list(map(int, input().split())))
c = 0
for x in range(1, 6):
	if (sum_l + x) % n != 1:
		c += 1
print(c)


n = int(input())
p = sum(list(map(int, input().split())))
q = 5
for i in range(1, 6):
	if (p + i) % (n + 1) == 1:
		q -= 1
print(q)


a = int(input()) + 1
b = list(map(int, input().split()))
c = sum(b) % a
if c == 0:
	c += a
count = 0
for i in range(1, 6):
	if (c + i) % a != 1:
		count += 1
print(count)


n = int(input())
friends = [int(i) for i in input().split()]
total = 0
for e in friends:
	total += e
total = total % (n + 1)
ans = 0
for i in range(1, 6):
	if (total + i) % (n + 1) != 1:
		ans += 1
print(ans)


friends = int(input())
fingers = sum(list(map(int, input().split())))
n = friends + 1
count = 0
for i in range(fingers + 1, fingers + 6):
	if (i - 1) / n % 1 != 0:
		count += 1
print(count)


n = int(input())
L = list(map(int, input().split()))
x = sum(L)
x %= n + 1
ans = 0
for i in range(1, 6):
	if (x + i) % (n + 1) != 1:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
f = sum(a)
i = 1
t = 0
y = f
while i <= 5:
	y = f + i
	if y % (n + 1) != 1:
		t += 1
	i += 1
print(t)


n = int(input())
fingers = sum(map(int, input().split()))
result = 0
for i in range(1, 6):
	if (i + fingers) % (n + 1) != 1:
		result += 1
print(result)


n = int(input()) + 1
k = sum(list(map(int, input().split())))
t = [i % n for i in range(k, k + 5)]
print(5 - t.count(0))


n = int(input()) + 1
m = sum([int(i) for i in input().split()])
res = 0
for i in range(1, 6):
	res += (i + m) % n != 1
print(res)


n = int(input())
fin = list(map(int, input().split()))
total_fin = sum(fin)
opt = 0
for i in range(1, 6):
	if (total_fin + i) % (n + 1) != 1:
		opt += 1
print(opt)


import sys
from math import sqrt, gcd, ceil, log
from collections import defaultdict, Counter, deque
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))

def main():
	n = int(input())
	s = sum(read()) % (n + 1)
	ans = 0
	for i in range(1, 6):
		if (s + i) % (n + 1) != 1:
			ans += 1
	print(ans)
main()


def main() -> int:
	n = int(input()) + 1
	fingers = [int(word) for word in input().split()]
	sum_fingers = sum(fingers)
	count = 0
	for i in range(sum_fingers + 1, sum_fingers + 6, 1):
		if i % n == 1:
			count += 1
	result = 5 - count
	print(result)
	return 0
main()


n = int(input())
l = list(map(int, input().split()))
s = 0
res = 0
for i in range(n):
	s += l[i]
for i in range(s + 1, s + 6):
	if i % (n + 1) == 1:
		res += 1
print(5 - res)


n = int(input())
a = [int(i) for i in input().split()]
d = sum(a)
c = 0
for i in range(1, 6):
	e = d + i
	if (e - 1) % (n + 1) != 0:
		c = c + 1
print(c)


n = eval(input())
y = [int(n) for n in input().split()]
x = 1
suma = 0
l = 5
occ = 0
lista = []
k = 0
while k < n:
	suma = suma + y[k]
	k += 1
while x <= n + 1:
	lista = lista + [x]
	x += 1
lista = 100 * lista
f = suma
while l > 0:
	if lista[f] != 1:
		occ += 1
	l -= 1
	f += 1
print(occ)


n = eval(input())
i = 0
s = 0
num = list(map(int, input().split()))
while i < n:
	s += num[i]
	i += 1
j = 1
c = 0
while j <= 5:
	if (j + s) % (n + 1) == 1:
		c = c + 1
	j += 1
print(5 - c)


n = int(input()) + 1
f = sum(map(int, input().split()))
count = 0
for i in range(1, 6):
	if (i + f) % n != 1:
		count += 1
print(count)


n = int(input())
t = sum(map(int, input().split()))
print(sum((1 if (t + i) % (n + 1) != 1 else 0 for i in range(1, 6))))


n = int(input())
l = input().split()
sum = 0
for i in l:
	sum += int(i)
count = 0
for i in range(5):
	if (sum + i) % (n + 1) != 0:
		count += 1
print(count)


n = int(input())
counts = list(map(int, input().split()))
count = sum(counts)
no_of_ways = 0
after_count = count % (n + 1)
for i in range(1, 6):
	if (count + i) % (n + 1) != 1:
		no_of_ways += 1
print(no_of_ways)


N = int(input())
A = list(map(int, input().split()))
sumA = sum(A)
ans = 0
for i in range(1, 5 + 1):
	if (sumA + i) % (N + 1) != 1:
		ans += 1
print(ans)


n = int(input())
fingers = [int(i) for i in input().split(' ')]
fingers = sum(fingers)
res = 0
for i in range(1, 6):
	if (fingers + i - 1) % (n + 1) != 0:
		res += 1
print(res)


def scan(type):
	return list(map(type, input().split()))
(n,) = scan(int)
arr = scan(int)
total = 0
for x in arr:
	total += x
n += 1
ans = 0
for i in range(1, 6):
	if (total + i) % n != 1:
		ans += 1
print(ans)


total = int(input()) + 1
current = sum(map(int, input().split()))
print(sum(((current + i) % total != 1 for i in range(1, 6))))


numFriends = int(input())
arr = input().strip().split(' ')
for i in range(len(arr)):
	arr[i] = int(arr[i])
result = []
s = sum(arr)
for j in range(1, 6):
	if (j + s) % (numFriends + 1) != 1:
		result.append(j)
print(len(result))


n = int(input())
List = list(map(int, input().split()))
ans = sum(List)
count = 0
for i in range(1, 6):
	if (ans + i) % (n + 1) != 1:
		count += 1
print(count)


kids = int(input()) + 1
fingers = list(map(int, input().strip().split()))
out = 0
for i in range(1, 6):
	if (sum(fingers) + i) % kids != 1:
		out += 1
print(out)


n = int(input())
a = [int(i) for i in input().split()]
k = 0
for i in range(1, 6):
	if (sum(a) + i) % (n + 1) != 1:
		k += 1
print(k)


n = int(input()) + 1
a = sum(map(int, input().split())) - 1
print(sum(((a + x) % n > 0 for x in range(1, 6))))


n = int(input()) + 1
f = list(map(int, input().split()))
arr = [1 + n * i for i in range(n * 5)]
a = []
for i in range(1, 6):
	if i + sum(f) not in arr:
		a.append(i)
print(len(a))


n = int(input())
arr = input().split(' ')
arr = [int(i) for i in arr]
nFingers = sum(arr)
count = 5
for i in range(1, 6):
	if (nFingers + i) % (n + 1) == 1:
		count -= 1
print(count)


n = int(input())
l = input()
l = l.split()
s = 0
a = 0
j = 0
for i in range(n):
	s += int(l[i])
for i in range(1, 6):
	if (i + s - 1) % (n + 1) != 0:
		j += 1
print(j)


n = int(input())
a = [int(i) for i in input().split()]
suma = sum(a)
ans = 0
for i in range(1, 6):
	if (suma + i) % (n + 1) != 1:
		ans += 1
print(ans)


n = int(input())
l = sum(map(int, input().split()))
print(len([i for i in range(1, 6) if (i + l) % (n + 1) != 1]))


n = int(input()) + 1
m = sum(list(map(int, input().split())))
m %= n
res = 5
for i in range(1, 6):
	m += 1
	if m % n == 1:
		res -= 1
print(res)


n = int(input())
line = list(map(int, input().split()))
s = sum(line)
ans = 0
for i in range(5):
	if (s + i) % (n + 1) != 0:
		ans += 1
print(ans)


a = int(input()) + 1
b = sum(list(map(int, input().split())))
print(len([i for i in [1, 2, 3, 4, 5] if (i + b) % a != 1]))


def main():
	n = int(input())
	f = [int(i) for i in input().split(' ')]
	s = sum(f) // (n + 1)
	r = sum(f) - s * (n + 1)
	ans = 0
	for i in range(sum(f) + 1, sum(f) + 6):
		if i % (n + 1) != 1:
			ans += 1
	print(ans)
main()


def friends(lst):
	s = sum(lst)
	result = 0
	for x in range(1, 6):
		if (x + s) % (len(lst) + 1) != 1:
			result += 1
	return result
n = int(input())
a = [int(j) for j in input().split()]
print(friends(a))


n = int(input()) + 1
a = sum(list(map(int, input().split())))
count = 0
if (a + 1) % n != 1:
	count += 1
if (a + 2) % n != 1:
	count += 1
if (a + 3) % n != 1:
	count += 1
if (a + 4) % n != 1:
	count += 1
if (a + 5) % n != 1:
	count += 1
print(count)


n = int(input()) + 1
fingers = sum(list(map(int, input().split())))
c = 0
for _ in range(1, 6):
	if (_ + fingers) % n != 1:
		c += 1
print(c)


n = int(input())
arr = list(map(int, input().split()))
tot = sum(arr)
ans = 0
for i in range(1, 6):
	if (tot + i) % (n + 1) != 1:
		ans += 1
print(ans)


n = int(input())
l = sum((int(u) for u in input().split()))
res = 0
for i in range(1, 6):
	if not (i + l) % (n + 1) == 1:
		res += 1
print(res)


import sys
n = int(sys.stdin.readline())
friends = list(map(int, sys.stdin.readline().split()))
count = 0
for dima in range(1, 5 + 1):
	total = sum(friends) + dima
	if total % (n + 1) != 1:
		count += 1
sys.stdout.write(str(count))


number_people = int(input())
fingers = [int(x) for x in input().split()]
sum_fingers = sum(fingers)
fingers_hand = [1, 2, 3, 4, 5]
counter = 0
for i in fingers_hand:
	all_fingers = i + sum_fingers
	while all_fingers > 0:
		all_fingers -= number_people + 1
		if all_fingers == 1:
			counter += 1
			break
print(5 - counter)


n = int(input())
L = list(map(int, input().split()))
s = sum(L)
c = 0
for i in range(1, 6):
	r = (s + i) % (n + 1)
	if r == 1:
		c += 1
print(5 - c)


n = int(input())
f = sum([int(i) for i in input().split(' ')])
c = 0
if n == 1:
	if f % 2 == 0:
		print(2)
	else:
		print(3)
else:
	for i in range(1, 6):
		if (f + i) % (n + 1) != 1:
			c += 1
	print(c)


(n, a) = (int(input()) + 1, list(map(int, input().split())))
print(sum([1 if (sum(a) + i) % n else 0 for i in range(5)]))


import sys
import math
import bisect

def solve(A):
	n = len(A) + 1
	ans = 0
	sum_val = sum(A)
	for i in range(1, 6):
		if (i + sum_val) % n != 1:
			ans += 1
	return ans

def main():
	n = int(input())
	A = list(map(int, input().split()))
	print(solve(A))
main()


n = input()
n = int(n)
arr = list(map(int, input().rstrip().split()))
Sum = 0
count = 0
for i in range(len(arr)):
	Sum = Sum + arr[i]
d = n + 1
for j in range(1, 6):
	if (Sum + j) % d != 1:
		count = count + 1
print(count)


n = int(input())
n += 1
f = list(map(int, input().split()))
s = sum(f)
res = 0
for i in range(1, 6):
	if (s + i) % n != 1:
		res += 1
print(res)


n = int(input())
l = list(map(int, input().split()))
a = 0
count = 0
for i in range(len(l)):
	a += l[i]
for i in range(5):
	a += 1
	if a % (n + 1) != 1:
		count += 1
print(count)


n = int(input())
t = sum(list(map(int, input().split())))
t_a = 0
for i in range(1, 6):
	if (t + i) % (n + 1) != 1:
		t_a += 1
print(t_a)


N = int(input())
X = sum(list(map(int, input().split())))
Count = 0
for i in range(1, 6):
	if (X + i) % (N + 1) != 1:
		Count += 1
print(Count)


n = int(input())
fl = list(map(int, input().split()))
s = sum(fl)
tf = (n + 1) * 5
k = 0
for i in range(1, 6):
	if (i + s) % (n + 1) != 1 and i + s <= tf:
		k += 1
print(k)


n = int(input())
a = list(map(int, input().split()))
n = n + 1
s = 0
for i in range(n - 1):
	s = s + a[i]
c = 0
for j in range(5):
	if (s + j + 1) % n != 1:
		c = c + 1
print(c)


n = int(input())
f = sum((int(x) for x in input().split()))
print(sum((1 for x in range(1, 6) if (f + x) % (n + 1) != 1)))


noOfFriends = int(input().strip())
total_fingers = sum([int(x) for x in input().strip().split()])
ans = 0
for i in range(1, 6):
	if (total_fingers + i - 1) % (noOfFriends + 1) == 0:
		ans = ans + 1
print(5 - ans)


sum = 0
c = 0
n = int(input())
a = []
a = input().split()
for i in range(n):
	sum += int(a[i])
for x in range(1, 6):
	if (sum + x) % (n + 1) == 1:
		pass
	else:
		c += 1
print(c)


x = int(input()) + 1
(p, c) = (sum(map(int, input().split())), 0)
for i in range(1, 6):
	if (p + i) % x != 1:
		c += 1
print(c)


n = int(input())
l = list(map(int, input().strip().split()))
r = sum(l)
friend = [0 for a in range(0, n)]
friend += [1]
count = 0
co = 0
while co != r:
	count = (count + 1) % (n + 1)
	co += 1
re = 0
for i in range(1, 6):
	if (count + i) % (n + 1) != 1:
		re += 1
print(re)


u = int(input())
v = list(map(int, input().split()))
io = [0 for i in range(200)]
yo = 1
for i in range(100):
	io[i] = yo
	yo = yo + u + 1
up = [1, 2, 3, 4, 5]
j = 0
for i in range(len(v)):
	j = j + v[i]
for i in range(len(up)):
	up[i] = up[i] + j
op = 5
for i in up:
	if i in io:
		op = op - 1
print(op)


import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

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

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
n = inp()
a = inlist()
sm = sum(a)
c = 0
for i in range(1, 6):
	sm += 1
	if sm % (n + 1) != 1:
		c += 1
print(c)


people = int(input()) + 1
fingers = sum(list(map(int, input().split())))
ret = 0
for i in range(1, 6):
	fingers += 1
	if fingers % people != 1:
		ret += 1
print(ret)


n = int(input())
sum = 0
a = list(map(int, input().split()))
for i in a:
	sum += i
count = 0
res = [True for i in range(1, sum + 7)]
for i in range(1, sum + 6, n + 1):
	if i < sum + 6:
		res[i] = False
for i in range(sum + 1, sum + 6):
	if res[i] == True:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
d = s % 5
b = 0
for i in range(1, 6):
	if (i + s) % (n + 1) != 1:
		b += 1
print(b)


n = int(input())
s = sum([int(x) for x in input().split()])
f = 0
for i in range(1, 6):
	if (s + i) % (n + 1) != 1:
		f += 1
print(f)


friend = int(input())
fingers = sum(list(map(int, input().split())))
current_place = fingers % (friend + 1)
ways = 0
for count in range(1, 5 + 1):
	if (count + current_place) % (friend + 1) != 1:
		ways += 1
print(ways)


a = int(input())
b = list((int(x) for x in input().split()))
s = 0
l = []
for i in b:
	s += i
for j in range(1, 6):
	if (s + j) % (a + 1) != 1:
		l.append(j)
	else:
		pass
print(len(l))


friends = int(input())
fingers = sum((int(i) for i in input().split(' ')))
n = 0
for i in range(5):
	if (fingers + i + 1) % (friends + 1) != 1:
		n += 1
print(n)


pers = int(input()) + 1
t = sum((int(i) for i in input().split()))
s = 0
for d in range(1, 5 + 1):
	if (d + t - 1) % pers != 0:
		s += 1
print(s)


n = int(input())
a = list(map(int, input().split()))
cnt = 0
n = n + 1
total = sum(a)
for i in range(1, 6):
	if (total + i) % n == 1:
		continue
	else:
		cnt += 1
print(cnt)


import sys

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

def iinput():
	return int(input())

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

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
n = iinput()
a = list(map(int, input().split()))
s1 = sum(a)
count = 0
for i in range(1, 6):
	if (s1 + i) % (n + 1) != 1:
		count += 1
print(count)


n = int(input())
a = [int(i) for i in input().split()]
count = 0
k = sum(a)
for i in range(1, 6):
	k_1 = k + i
	j = k_1 % (n + 1)
	if j != 1:
		count = count + 1
print(count)


noOfFriends = int(input()) + 1
fingers = input()
fingers = fingers.split(' ')
fingers = [int(i) for i in fingers]
totalNoOfFingers = sum(fingers)
rFingers = totalNoOfFingers % noOfFriends
arc = noOfFriends - rFingers
ans = 0
if arc < 5:
	for i in range(1, 6):
		if (rFingers + i) % noOfFriends != 1:
			ans = ans + 1
	print(ans)
else:
	print('5')


number = int(input())
lst = list(map(int, input().split()))
s = sum(lst)
ans = 0
for i in range(5):
	if (s + i) % (number + 1) != 0:
		ans += 1
print(ans)


import sys
import math
n = int(sys.stdin.readline())
an = [int(x) for x in sys.stdin.readline().split()]
vsum = sum(an)
res = 0
for i in range(1, 6):
	if (i + vsum) % (n + 1) != 1:
		res += 1
print(res)


n = int(input())
arr = [int(i) for i in input().split(' ')]
s = 0
for i in range(n):
	s += arr[i]
n += 1
res = 0
for i in range(1, 6):
	if (s + i) % n != 1:
		res += 1
print(res)


n = int(input())
n += 1
frnds = list(map(int, input().split()))
total = sum(frnds)
count = 0
for i in range(1, 5 + 1):
	if (total + i) % n != 1:
		count += 1
print(count)


n = int(input())
a = input()
sum = 0
for i in range(len(a)):
	if i % 2 == 0:
		sum += int(a[i])
ways = 0
for j in range(1, 6):
	if (sum + j) % (n + 1) == 1:
		pass
	else:
		ways += 1
print(ways)


n = int(input())
n = n + 1
a = list(map(int, input().split()))
b = [1, 2, 3, 4, 5]
cnt = 0
s = sum(a)
rem = s % n
if n == 2:
	if a[0] % 2 != 0:
		print('3')
	else:
		print('2')
else:
	for i in range(len(b)):
		if (s + b[i]) % n != 1:
			cnt = cnt + 1
	print(cnt)


n = int(input())
fs = list(map(int, input().split()))
total = sum(fs)
cnt = 0
for i in range(1, 6):
	if (total + i) % (n + 1) != 1:
		cnt += 1
print(cnt)


n = int(input())
a = list(map(int, input().split()))
k = sum(a)
m = 0
for i in range(1, 6):
	if (k + i) % (n + 1) != 1:
		m += 1
print(m)


n = int(input())
v = [int(y) for y in input().split()]
soma = 0
aux = 0
for i in range(n):
	soma += v[i]
ans = 0
for i in range(1, 6, 1):
	if (soma + i) % (n + 1) == 0:
		ans += 1
		continue
	elif (soma + i) % (n + 1) > 1:
		ans += 1
print(ans)


n = int(input())
su = 0
per = 0
for x in input().split():
	su += int(x)
for x in range(1, 6):
	if (su + x) % (n + 1) != 1:
		per += 1
print(per)


n = int(input())
fing = [int(i) for i in input().split()]
frnds = 0
for i in fing:
	frnds += i
ways = 0
for i in range(1, 6):
	if (frnds + i) % (n + 1) != 1:
		ways += 1
print(ways)


n = int(input()) + 1
fingers = [int(i) for i in input().split()]
suma = sum(fingers)
cnt = 0
for i in range(1, 6):
	if (suma + i) % n == 1:
		continue
	else:
		cnt += 1
print(cnt)


def main():
	amigos = int(input()) + 1
	dedos = sum([int(x) for x in input().split()])
	possib = 0
	for i in range(1, 6):
		aux = dedos + i
		if aux % amigos != 1:
			possib += 1
	print(possib)
main()


from math import ceil
n = int(input())
p = sum(list(map(int, input().split())))
c = 0
for i in range(1, 5 + 1):
	if (p + i + n) % (n + 1) == 0:
		c += 1
print(5 - c)


n = int(input())
f = input()
a = 0
for i in range(len(f)):
	if f[i] != ' ':
		a += int(f[i])
c = 0
for i in range(1, 6, 1):
	x = a + i - 1
	if x % (n + 1) != 0:
		c += 1
print(c)


n = int(input()) + 1
check = list(range(1, n * 5, n))
val = sum(map(int, input().split()))
c = 0
for i in range(1, 6):
	if i + val in check:
		pass
	else:
		c += 1
print(c)


n = int(input()) + 1
f = sum(map(int, input().split()))
l = [x for x in range(1, 6) if (f + x) % n != 1]
print(len(l))


n = int(input())
arr = sum([int(x) for x in input().split()])
c = 0
for x in range(1, 6):
	if (arr + x - 1) % (n + 1) != 0:
		c += 1
print(c)


n = int(input())
f = list(map(int, input().split(' ')))
v = sum(f)
cnt = 0
for i in range(1, 6):
	if (v + i) % (n + 1) == 1:
		pass
	else:
		cnt += 1
print(cnt)


def solve(n, d):
	other = 0
	for i in d:
		other += i
	ways = 0
	for i in range(1, 6):
		if (other + i) % (n + 1) != 1:
			ways += 1
	print(ways)

def main():
	n = int(input())
	d = input()
	d = [int(i) for i in d.split()]
	solve(n, d)
main()


n = 1 + int(input())
s = sum(map(int, input().split()))
print(sum(((i + s) % n != 1 for i in [1, 2, 3, 4, 5])))


n = int(input()) + 1
A = sum(map(int, input().split()))
print(sum(((A + i) % n != 1 for i in range(1, 6))))


n = int(input())
arr = [int(x) for x in input().split()]
summ = sum(arr)
ans = 0
for i in range(1, 6):
	if (i + summ) % (n + 1) == 1:
		continue
	else:
		ans += 1
print(ans)


n = int(input()) + 1
fing = list(map(int, input().split()))
s = sum(fing)
ct = 0
for i in range(1, 6):
	if (s + i) % n != 1:
		ct += 1
print(ct)


a = int(input())
t = list(map(int, input().split()))
s = sum(t)
p = 0
for k in range(1, 6):
	if (s + k) % (a + 1) != 1:
		p += 1
print(p)


n = int(input())
total = 0
z = [x for x in map(int, input().split())]
for i in z:
	total += i
answer = 0
for i in range(1, 5 + 1):
	if (total + i) % (n + 1) != 1:
		answer += 1
print(answer)


n = int(input())
figers = sum([int(i) for i in input().split()])
ans = 0
for i in range(1, 6):
	if (figers + i) % (n + 1) != 1:
		ans += 1
print(ans)


import sys
try:
	sys.stdin = open('inputs.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
finally:
	input = sys.stdin.readline
	print = sys.stdout.write
n = int(input()) + 1
fing = list(map(int, input().split()))
totalfings = (sum(fing) + 1, sum(fing) + 5)

def countwithremainderone(x, n):
	if x % n == 0:
		return x // n
	return x // n + 1
print(str(5 - (countwithremainderone(totalfings[1], n) - countwithremainderone(totalfings[0] - 1, n))))


n = int(input())
fings = list(map(int, input().split()))
tot = sum(fings)
ways = 0
for i in range(1, 6):
	if (tot + i) % (n + 1) != 1:
		ways += 1
print(ways)


players = int(input())
lista = sum(list(map(int, input().split())))
vezes = 0
for i in range(1, 6):
	if (i + lista) % (players + 1) != 1:
		vezes += 1
print(vezes)


n = int(input())
a = list(map(int, input().split()))
x = [i for i in range(1, 5 * (n + 1), n + 1)]
cnt = 0
for i in range(sum(a) + 1, sum(a) + 6):
	if i in x:
		cnt += 1
print(5 - cnt)


n = int(input())
L = map(int, input().split())
L = list(L)
total = sum(L)
due = []
count = 0
for i in range(1, total + 6, n + 1):
	due.append(i)
for i in range(1, 6):
	if not total + i in due:
		count += 1
print(count)


n = int(input())
s = sum((int(x) for x in input().split()))
ans = 0
for i in range(5):
	if (s + i) % (n + 1):
		ans += 1
print(ans)


q = int(input())
dedos = [int(i) for i in input().split()]
cont = 0
for i in range(1, 6):
	if (i - 1 + sum(dedos)) % (len(dedos) + 1) != 0:
		cont += 1
print(cont)


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
m = [1, 2, 3, 4, 5]
c = 0
for i in m:
	if (s + i) % (n + 1) != 1:
		c += 1
print(c)


no_of_friends = int(input())
A = [int(x) for x in input().split()]
pointer = 0
n = no_of_friends + 1
for i in range(no_of_friends):
	pointer += A[i]
	while pointer > n:
		pointer -= n
cnt = 0
for i in range(1, 6):
	p = pointer + i
	while p > n:
		p -= n
	if p != 1:
		cnt += 1
print(cnt)


n = int(input())
fingers = list(map(int, input().split()))
total_fingers = 0
for finger in fingers:
	total_fingers = total_fingers + finger
m = 0
unwanted_sums = list(range(1, 5 * n + 6, n + 1))
for i in range(1, 6):
	if total_fingers + i not in unwanted_sums:
		m += 1
print(m)


n = int(input())
a = sum(map(int, input().split()))
li = [(a + i) % (n + 1) != 1 for i in range(1, 6)]
print(sum(li))


n = int(input())
n += 1
list1 = list(map(int, input().split(' ')))
sum1 = sum(list1)
count = 0
for i in range(1, 6):
	if (sum1 + i) % n != 1:
		count += 1
print(count)


n = int(input())
s = input()
l = s.split(' ')
sum = 0
for num in l:
	sum += int(num)
a = 0
for i in range(1, 6):
	if (sum + i) % (n + 1) != 1:
		a += 1
print(a)


t = int(input())
ls1 = list(map(int, input().strip().split()))
sm = sum(ls1)
ct = 0
for i in range(1, 6):
	if (sm + i) % (t + 1) != 1:
		ct += 1
print(ct)


def dima(n, f):
	fingers = sum(f)
	c = 0
	for i in range(1, 6):
		if (fingers + i) % (n + 1) != 1:
			c += 1
	return c
n = int(input())
f = list(map(int, input().split()))
print(dima(n, f))


n = int(input())
l = [int(x) for x in input().split(' ')]
sum = 0
for i in l:
	sum += i
c = 0
for i in range(1, 6):
	if (sum + i) % (n + 1) != 1:
		c += 1
print(c)


def count_variants():
	n = int(input())
	friends_fingers = sum([int(x) for x in input().split()])
	fingers = [x + friends_fingers - 1 for x in range(1, 6)]
	num_var = 0
	for i in fingers:
		if i % (n + 1) != 0:
			num_var += 1
	return num_var
print(count_variants())


n = int(input())
a = [int(x) for x in input().split()]
sum = 0
for i in range(0, len(a)):
	sum += a[i]
count = 0
for i in range(1, 6):
	s = sum + i
	r = s % (n + 1)
	if r != 1:
		count += 1
print(count)


x = int(input())
list1 = input().split(' ')
list1 = [int(i) for i in list1]
tot_p = x + 1
list2 = []
sumfin = 0
for i in range(0, x):
	sumfin = sumfin + list1[i]
for i in range(1, 6):
	if (sumfin + i) % tot_p != 1:
		list2.append(i)
print(len(list2))


n = int(input())
x = list(map(int, input().split()))
count = 0
if n == 1:
	if x[0] % 2 == 0:
		print(2)
	else:
		print(3)
else:
	for i in range(1, 6):
		if (sum(x) + i) % (n + 1) != 1:
			count += 1
	print(count)


x = int(input())
lst = list(map(int, input().split()))
k = sum(lst)
c = 0
for i in range(1, 6):
	if (k + i) % (x + 1) != 1:
		c += 1
print(c)


n = int(input())
arr = [int(x) for x in input().split()]
s = sum(arr)
if n == 1:
	if s & 1:
		print(3)
	else:
		print(2)
elif n == 2:
	if s & 1:
		print(2)
	else:
		print(3)
elif n == 3:
	if s & 1:
		print(4)
	else:
		print(3)
elif n + 1 - s % (n + 1) >= 5:
	print(5)
else:
	print(4)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def solve(n, f):
	_sum = sum(f)
	count = 0
	for i in range(1, 6):
		if (_sum + i) % n != 1:
			count += 1
	return count
n = inp()
f = inlt()
print(solve(n + 1, f))


n = int(input())
t = sum([int(x) for x in input().split()])
slon = 0
for i in range(1, 6):
	if (i + t) % (n + 1) != 1:
		slon += 1
print(slon)


n = int(input())
x = input().strip().split()
total = 0
hand = 0
for i in range(len(x)):
	total = total + int(x[i])
for j in range(5):
	j = j + 1
	if (total + j) % (n + 1) != 1:
		hand = hand + 1
print(hand)


n = int(input())
f_line = input()
f_arr = [int(y) for y in f_line.split()]
n1 = n + 1
sum_arr = sum(f_arr)
fing_arr = [1, 2, 3, 4, 5]
ans = 0
for i in fing_arr:
	copy_arr = fing_arr.copy()
	temp_sum = sum_arr + i
	if temp_sum % n1 != 1:
		ans += 1
print(ans)


a = int(input())
b = input()
c = list(b)
d = []
d = b.split(' ')
f = len(d)
e = 0
g = 0
while e < f:
	g = g + int(d[e])
	e += 1
h = 0
i = 1
while i <= 5:
	if (i + g) % (a + 1) != 1:
		h += 1
	i += 1
print(h)


s = int(input())
l = list(map(int, input().split()))
summ = sum(l)
ans = 0
for i in range(1, 6):
	if (summ + i) % (s + 1) != 1:
		ans += 1
print(ans)


n = int(input())
l = [int(i) for i in input().split()]
total = n + 1
s = sum(l)
ans = 0
for i in range(5):
	s += 1
	if s % (n + 1) == 1:
		pass
	else:
		ans += 1
print(ans)


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())
num_people = inp() + 1
friends_fingers = sum(list(invr()))
count = 5
for i in range(1, 6):
	if (friends_fingers + i - 1) % num_people == 0:
		count -= 1
print(count)


n = int(input())
p = input().split()
s = 0
for i in range(len(p)):
	s += int(p[i])
k = 0
for i in range(1, 6):
	if (s + i - 1) % (n + 1) != 0:
		k += 1
print(k)


f = int(input())
a = sum(list(map(int, input().split())))
r = [1]
for i in range(f):
	r.append(0)
p = 5
j = a % (f + 1) - 1
for i in range(j, j + 5):
	if r[(i + 1) % (f + 1)] == 1:
		p -= 1
print(p)


n = int(input())
a = list(map(int, input().split()))
h = [1, 2, 3, 4, 5]
count = 0
for item in h:
	if (sum(a) + item) % (n + 1) != 1:
		count = count + 1
print(count)


n = int(input())
l = [int(x) for x in input().split()]
s = sum(l)
p = 0
c = 0
for t in range(1, 6):
	p = s + t
	j = 1
	i = 1
	while i <= p:
		if j == 1 and i == p:
			c += 1
		if j == n + 1:
			j = 1
		else:
			j += 1
		i += 1
print(5 - c)


n = int(input())
p = list(map(int, input().split()))
t = 0
s = 0
for i in range(n):
	t += p[i]
for i in range(1, 6):
	t += 1
	if t % (n + 1) == 1:
		continue
	else:
		s += 1
print(s)


n = int(input())
l = [int(x) for x in input().split()]
f = n + 1
s = sum(l)
count = 0
for x in range(1, 6):
	if (s + x) % f != 1:
		count += 1
print(count)


n = int(input())
arr = [int(i) for i in input().split()]
s = sum(arr)
res = 5
for i in range(1, 6):
	if (i + s) % (n + 1) == 1:
		res = res - 1
print(res)


n = int(input())
fingers = sum(map(int, input().split(' ')))
print(sum([1 if (fingers + i + 1) % (n + 1) != 1 else 0 for i in range(5)]))


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
k = 0
i = 1
while i < 6:
	r = s + i
	if r % (n + 1) != 1:
		k += 1
	i += 1
print(k)


p = int(input()) + 1
lf = [int(i) for i in input().split()]
nf = 0
for i in lf:
	nf += i
c = 0
for i in range(1, 6):
	if (nf + i) % p != 1:
		c += 1
print(c)


n = int(input())
f = list(map(int, input().split()))
t = sum(f)
n += 1
c_pos = t % n
x = 0
for i in range(1, 6):
	if (c_pos + i) % n != 1:
		x += 1
print(x)


n = 1 + int(input())
s = sum(map(int, input().split()))
x = 0
for i in [1, 2, 3, 4, 5]:
	if (i + s) % n != 1:
		x += 1
print(x)


n = int(input())
m = list(map(int, input().split()))
sum = 0
for i in range(len(m)):
	sum += m[i]
h = 0
for i in range(1, 6):
	if (sum - 1 + i) % (n + 1) != 0:
		h += 1
print(h)


a = int(input())
b = input().split()
p = 0
for i in range(len(b)):
	p = p + int(b[i])
s = 0
for i in range(1, 6):
	finger = i
	if (p + i) % (a + 1) != 1:
		s = s + 1
print(s)


n = int(input()) + 1
lst = list(map(int, input().split()))
summ = sum(lst)
ways = 0
chance = summ % n
for i in range(1, 6):
	if (summ + i) % n == 1:
		ways += 1
print(5 - ways)


n = int(input())
nums = list(map(int, input().split()))[:n]
total = sum(nums)
count = 0
for i in range(1, 6):
	if (i + total) % (n + 1) != 1:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
summ = 0
for i in range(n):
	summ += a[i]
ans = 0
for i in range(1, 6):
	if (summ + i) % (n + 1) != 1:
		ans += 1
print(ans)


import sys
import collections
import math
import itertools as it

def readArray(type=int):
	line = input()
	return [type(x) for x in line.split()]

def solve():
	n = int(input())
	arr = readArray()
	tot = sum(arr)
	cc = 0
	for x in range(1, 6):
		if (tot + x) % (n + 1) == 1:
			cc += 1
	print(5 - cc)
solve()


n = int(input())
f = list(map(int, input().split()))
s = 0
ans = 0
for i in range(0, n):
	s += f[i]
for j in range(1, 6):
	if (s + j) % (n + 1) == 1:
		pass
	else:
		ans += 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
x = list()
noc = n + 1
for i in range(1, 6):
	if (sum(l) + i) % noc != 1:
		x.append(i)
print(len(x))


n = int(input())
z = list(map(int, input().split()))
k = sum(z)
p = 0
for i in range(1, 6):
	if (k + i) % (n + 1) != 1:
		p = p + 1
print(p)


num = int(input())
fingers = list(map(int, input().split()))
ans = 0
options = [1, 2, 3, 4, 5]
back = num + 1
count = sum(fingers) - 1
for i in options:
	if (count + i) % back != 0:
		ans += 1
print(ans)


no_of_friends = int(input())
finger = list(map(int, input().split()))
totalFinger = sum(finger)
li = []
for i in range(1, 6):
	if (totalFinger + i) % (no_of_friends + 1) != 1:
		li.append(i)
ans = len(li)
print(ans)


n = int(input())
num = sum(list(map(lambda x: int(x), input().split(' '))))
ans = 0
for i in range(1, 6):
	if (num + i) % (n + 1) is not 1:
		ans += 1
print(ans)


n = int(input())
list1 = list(map(int, input().split()))
sum1 = sum(list1)
count = 0
if (sum1 + 1) % (n + 1) != 1:
	count += 1
if (sum1 + 2) % (n + 1) != 1:
	count += 1
if (sum1 + 3) % (n + 1) != 1:
	count += 1
if (sum1 + 4) % (n + 1) != 1:
	count += 1
if (sum1 + 5) % (n + 1) != 1:
	count += 1
print(count)


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


n = int(input())
n += 1
li = [int(x) for x in input().split()]
sum = 0
count = 0
for i in li:
	sum += i
for i in range(1, 6):
	if (sum + i) % n != 1:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split(' ')))
sumA = sum(a)
count = 0
for x in range(1, 5 + 1):
	if (x + sumA) % (n + 1) == 1:
		count += 1
print(5 - count)


n = int(input()) + 1
ls = [int(x) for x in input().split()]
a = sum(ls)
print(len([x for x in range(5) if (a + x) % n != 0]))


from sys import stdin
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
s = 0
for i in range(n):
	s += arr[i]
p = s % (n + 1)
count = 0
for i in range(1, 6):
	if (p + i) % (n + 1) != 1:
		count += 1
print(count)


import itertools
import math
from collections import defaultdict

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

def solve():
	n = int(input()) + 1
	s = sum(input_ints())
	ans = 0
	for x in range(1, 6):
		if (x + s) % n != 1:
			ans += 1
	print(ans)
solve()


def single_integer():
	return int(input())

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

def string():
	return input()

def multi_string():
	return input().split()
n = single_integer()
total = sum(multi_integer())
ans = 0
i = 1
while i < 6:
	if (total + i) % (n + 1) != 1:
		ans += 1
	i += 1
print(ans)


from sys import stdin
n = int(stdin.readline())
a = [int(i) for i in stdin.readline().split(' ')]
s = sum(a)
count = 0
for i in range(1, 6):
	temp = s + i
	if temp % (n + 1) != 1:
		count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
w = 0
for i in range(1, 6):
	su = sum(l)
	su += i
	for j in range(1, (n + 1) * 5, n + 1):
		if su == j:
			w += 1
			break
print(5 - w)


n = int(input()) + 1
data = list(map(int, input().split()))
cnt = 0
tmp = sum(data)
for i in range(1, 6):
	if (tmp + i) % n != 1:
		cnt += 1
print(cnt)


n = int(input())
ns = list(map(int, input().split()))
s = sum(ns)
op1 = [s + 1, s + 2, s + 3, s + 4, s + 5]
op2 = [1, 2 + n, 3 + 2 * n, 4 + 3 * n, 5 + 4 * n]
op3 = []
for i in range(len(op1)):
	a = 0
	for j in range(len(op2)):
		if op1[i] == op2[j]:
			a = a + 1
	if a == 0:
		op3.append(op1[i])
print(len(op3))


n = eval(input())
y = list(map(int, input().split()))
i = 0
c = 0
x = 0
while i < len(y):
	x += y[i]
	i += 1
i = 1
while i <= 5:
	if (x + i) % (n + 1) != 1:
		c += 1
	i += 1
print(c)


n = int(input())
dedos = 0
entrada = input()
for i in entrada.split(' '):
	dedos += int(i)
dima = [1]
res = 0
while dima[-1] <= dedos + 5:
	dima.append(dima[-1] + (n + 1))
for i in range(1, 6):
	if dedos + i not in dima:
		res += 1
print(res)


n = int(input())
f = [int(x) for x in input().split()]
poss = 0
sumF = sum(f)
for i in range(1, 6):
	sumF += i
	if sumF % (n + 1) != 1:
		poss += 1
	sumF -= i
print(poss)


a = int(input())
b = list(map(int, input().split()))
t = sum(b)
k = 0
for i in range(1, 6):
	r = t + i
	if r % (a + 1) != 1:
		k = k + 1
print(k)


friendno = int(input())
fingerlist = list(map(int, input().split()))
number = friendno + 1
sum = 0
ways = 0
for i in fingerlist:
	sum = sum + i
for j in range(1, 6):
	if (sum + j) % number != 1:
		ways = ways + 1
print(ways)


n = int(input()) + 1
s = sum(map(int, input().split()))
ans = 5
for i in range(1, 6):
	if (s + i) % n == 1:
		ans -= 1
print(ans)


friends = int(input())
friends = friends + 1
total = 0
ways = 0
for i in input().split():
	total = total + int(i)
for j in range(1, 6):
	if (total + j) % friends != 1:
		ways += 1
print(ways)


a = int(input())
b = sum(map(int, input().split())) % (a + 1)
print(sum(((b + i) % (a + 1) != 1 for i in range(1, 6))))


import itertools

def main():
	n = int(input())
	data = [int(v) for v in input().split()]
	s = sum(data)
	d = 0
	for i in range(1, 6):
		if (s + i) % (n + 1) != 1:
			d += 1
	print(d)
main()


import functools
n = int(input())
sumArr = functools.reduce(lambda x, y: x + y, map(lambda x: int(x), input().split(' ')))
ost = sumArr % (n + 1)
count = 0
for i in range(1, 6):
	if (ost + i) % (n + 1) != 1:
		count += 1
print(count)


friends = int(input()) + 1
fingers = sum([int(x) for x in input().split(' ')])
total = 0
for i in range(1, 6):
	if (fingers + i) % friends != 1:
		total += 1
print(total)


n = int(input())
fingers = sum([int(x) for x in input().split()])
count = 0
for i in range(1, 5 + 1):
	if (fingers + i) % (n + 1) != 1:
		count += 1
print(count)


n = int(input())
A = list(map(int, input().split()))
fingers = sum(A) - 1
n += 1
an = 0
for i in range(1, 6):
	if (fingers + i) % n != 0:
		an += 1
print(an)


n = int(input())
A = list(map(int, input().split()))
sum_A = sum(A)
ans = 0
for i in range(1, 6):
	if (sum_A + i) % (n + 1) != 1:
		ans += 1
print(ans)


f = int(input())
l = [int(z) for z in input().split(' ')]
s = sum(l)
c = 0
if (s + 1) % (f + 1) != 1:
	c = c + 1
if (s + 2) % (f + 1) != 1:
	c = c + 1
if (s + 3) % (f + 1) != 1:
	c = c + 1
if (s + 4) % (f + 1) != 1:
	c = c + 1
if (s + 5) % (f + 1) != 1:
	c = c + 1
print(c)


n = int(input())
lst = list(map(int, input().split()))
summ = sum(lst)
cnt = 0
for i in range(1, 6):
	if (i + summ) % (n + 1) != 1:
		cnt += 1
print(cnt)


n = int(input())
f = input().split(' ')
total = 0
for i in f:
	total += int(i)
total -= 1
rest = total % (n + 1)
c = 0
for i in range(1, 6):
	if not (rest + i) % (n + 1) is 0:
		c += 1
print(c)


n = int(input())
f = list(map(int, input().split()))
l = []
for i in range(6):
	l.append((n + 1) * i + 1)
g = []
s = sum(f)
for i in range(1, 6):
	if s + i not in l:
		g.append(i)
print(len(g))


n = int(input())
m = sum(map(int, input().split()))
a = 5
for x in range(1, 6):
	if (m + x) % (n + 1) == 1:
		a -= 1
print(a)


n = int(input())
arr = list(map(int, input().split()))
s = sum(arr)
c = 0
for i in range(1, 6):
	t = s
	t += i
	if t % (n + 1) == 1:
		continue
	else:
		c += 1
print(c)


import math

def sumofno(n):
	summ = 0
	while n > 0:
		summ += n % 10
		n //= 10
	return summ

def get_key(val, lis):
	for (key, value) in lis.items():
		if value == val:
			return key

def isprime(val):
	c = 0
	for j in range(2, val):
		if val % j == 0:
			return False
	return True
try:
	ans = []
	for i in range(1):
		n = int(input())
		a = list(map(int, input().split()))
		summ = sum(a)
		co = 0
		for d in range(1, 6):
			pr = summ + d - 1
			if pr % (n + 1) != 0:
				co += 1
			else:
				continue
		ans.append(co)
	for an in ans:
		print(an)
except:
	pass


import sys
n = int(input())
n += 1
lisa = [int(x) for x in input().strip().split()]
sulis = sum(lisa)
cona = 0
for k in range(1, 6):
	if (k + sulis) % n != 1:
		cona += 1
print(cona)


a = int(input())
s = sum(list(map(int, input().split())))
z = 0
for i in range(1, 6):
	if (s + i) % (a + 1) != 1:
		z += 1
print(z)


n = int(input())
a = [int(x) for x in input().split()]
ctr = int(0)
sum_a = sum(a)
for i in range(1, 6):
	if (sum_a + i) % (n + 1) == 1:
		ctr += 1
print(5 - ctr)


n = int(input())
llt = list(map(int, input().split()))
s = sum(llt)
if n > 3:
	x = s % (n + 1)
	if x + 5 < n + 2 and x != 0:
		print('5')
	else:
		print('4')
elif n == 3:
	if s % 4 == 0:
		print('3')
	else:
		print('4')
elif n == 2:
	if s % 3 == 1:
		print('4')
	else:
		print('3')
elif n == 1:
	if s % 2 == 0:
		print('2')
	else:
		print('3')


n = int(input())
l = list(map(int, input().split()))
friend = n + 1
s = sum(l)
count = 5
for i in range(5):
	r = (s + i + 1) % friend
	if r == 1:
		count -= 1
print(count)


n = int(input())
n += 1
a = [int(i) for i in input().split()]
s = sum(a)
c = 0
i = 1
while i <= 5:
	if (s + i) % n != 1:
		c += 1
	i += 1
print(c)


n = int(input())
s = input().split()
for i in range(n):
	s[i] = int(s[i])
t = sum(s)
ans = 5
for i in range(1, 6):
	x = t + i
	if x % (n + 1) == 1:
		ans -= 1
print(ans)


class Code:

	def __init__(self):
		self.n = int(input())
		self.arr = list(map(int, input().split()))

	def process(self):
		(s, cnt) = (sum(self.arr), 0)
		for i in range(1, 6):
			if (s + i - 1) % (self.n + 1) != 0:
				cnt += 1
		print(cnt)
code = Code()
code.process()


n = int(input())
a = list(map(int, input().split()))
other_fingers = sum(a)
NO_OF_FINGERS = 5
no_of_choices = 0
no_of_people = n + 1
for i in range(1, NO_OF_FINGERS + 1):
	total_fingers = other_fingers + i
	no_of_choices += total_fingers % no_of_people != 1
print(no_of_choices)


n = int(input())
m = list(map(int, input().split()))
nop = n + 1
noc = 0
of = sum(m)
for i in range(1, 6):
	tf = of + i
	if tf % nop != 1:
		noc += 1
print(noc)


n = int(input())
a = map(int, input().split(' '))
s = sum(a)
ans = 0
for i in range(1, 6):
	if (s + i) % (n + 1) != 1:
		ans += 1
print(ans)


n = int(input())
c = 0
arr = list(map(int, input().split(' ')))
for i in arr:
	c += i
b = [c + 1, c + 2, c + 3, c + 4, c + 5]
count = 0
for j in b:
	if j % (n + 1) == 1:
		count += 1
print(5 - count)


f = eval(input())
i = 0
s = 0
fingers = input().split()
while i < f:
	s = s + int(fingers[i])
	i = i + 1
j = 1
c = 0
while j <= 5:
	if (j + s) % (f + 1) == 1:
		c = c + 1
	j = j + 1
print(5 - c)


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')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]

def solve():
	n = readint()
	sumArr = sum(readarri())
	cnt = 0
	for i in range(1, 6):
		sumArr += i
		reM = sumArr % (n + 1) - 1
		if reM != 0:
			cnt += 1
		sumArr -= i
	print(cnt)

def main():
	t = 1
	for _ in range(t):
		solve()
main()


def solve():
	n = int(input()) + 1
	s = sum(map(int, input().rstrip().split()))
	r = 0
	for i in range(1, 6):
		if (s + i) % n != 1:
			r += 1
	print(r)
solve()


n = int(input())
ls = list(map(int, input().split()))
friends = sum(ls)
nls = []
for i in range(friends):
	if i % (n + 1) == 0:
		nls.append('B')
	else:
		nls.append(0)
for i in range(5):
	if (friends + i) % (n + 1) == 0:
		nls.append('B')
	else:
		nls.append(0)
print(nls[friends:].count(0))


n = int(input())
sm = sum(list(map(int, input().split())))
ans = 0
for i in range(1, 6):
	ans += (sm + i) % (n + 1) != 1
print(ans)


t = int(input())
a = input().split(' ')
f = 0
for i in range(t):
	a[i] = int(a[i])
	f += a[i]
c = 5
for i in range(1, 6):
	if (i + f) % (t + 1) == 1:
		c -= 1
print(c)


import sys
import math
import collections
from collections import deque
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))
T = 1
for _ in range(T):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	n = n + 1
	c = 0
	for i in range(1, 6):
		if (sum(a) + i - 1) % n == 0:
			c += 1
	print(5 - c)


num_people = 1 + int(input())
friends_sum = sum(list(map(int, input().split())))
solutions = 5
for total_sum in range(1 + friends_sum, 6 + friends_sum):
	if total_sum % num_people == 1:
		solutions -= 1
print(solutions)


n = int(input())
arr = list(map(int, input().split()))
total = sum(arr)
res = 0
for i in range(1, 6):
	if (total + i) % (n + 1) != 1:
		res += 1
print(res)


friend = int(input())
finger = [int(i) for i in input().split()]
count = 0
for i in range(1, 6):
	count += 0 if (sum(finger) + i) % (friend + 1) == 1 else 1
print(count)


a = int(input())
b = [int(j) for j in input().split()]
c = sum(b)
d = 0
for k in range(1, 6):
	if (c + k) % (a + 1) == 1:
		continue
	else:
		d += 1
print(d)


def dima(fingers):
	l = []
	sum1 = sum(fingers)
	for i in range(1, 6):
		if (i + sum1) % (n + 1) != 1:
			l.append(i)
		else:
			continue
	return len(l)
n = int(input())
fingers = list(map(int, input().split()))
result = dima(fingers)
print(result)


sa = int(input())
sa2 = input().split(' ')
sa3 = [int(x) for x in sa2]
sumx = sum(sa3)
t = 0
for sa4 in range(1, 6):
	if (sumx + sa4) % (sa + 1) != 1:
		t += 1
print(t)


x = int(input())
l = list(map(int, input().split()))
(s, answer) = (0, 0)
for i in l:
	s += i
ans = s % (x + 1) - 1
for i in range(1, 6):
	if (i + ans) % (x + 1) != 0:
		answer += 1
print(answer)


n = int(input())
li = list((int(i) for i in input().strip().split(' ')))
s = sum(li)
count = 0
for i in [1, 2, 3, 4, 5]:
	if (s + i) % (n + 1) != 1:
		count += 1
print(count)


import time, math
from sys import stdin, stdout

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

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

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

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

def Si():
	return sorted(list(map(int, stdin.readline().split())), reverse=True)

def P(x):
	return stdout.write(str(x) + '\n')

def Pi(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def solve():
	n = I()
	l = L()
	s = sum(l)
	boo = 0
	for i in range(1, 6):
		if (s + i) % (n + 1) != 1:
			boo += 1
	P(boo)
solve()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
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 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 main():
	n = I()
	a = LI()
	s = sum(a)
	r = 0
	for i in range(1, 6):
		if (s + i) % (n + 1) != 1:
			r += 1
	return r
print(main())


n = int(input())
fingers = sum([int(x) for x in input().split(' ')])
ways = 0
for i in range(1, 6):
	if (i + fingers) % (n + 1) != 1:
		ways += 1
print(ways)


def main():
	n = int(input())
	arr = list(map(int, input().split()))
	curr = (sum(arr) - 1) % (n + 1)
	c = 0
	for i in range(1, 6):
		if (curr + i) % (n + 1) != 0:
			c += 1
	print(c)
main()


n = int(input())
t = 0
a = [int(i) for i in input().split()]
z = [sum(a) + 1, sum(a) + 2, sum(a) + 3, sum(a) + 4, sum(a) + 5]
for i in range(5):
	if z[i] % (n + 1) != 1:
		t += 1
print(t)


n = int(input())
a = list(map(int, input().split(' ')))
b = sum(a)
z = 0
for i in range(b + 1, b + 6):
	for j in range(1, b + 6, n + 1):
		if i == j:
			z += 1
print(5 - z)


a = int(input())
b = list(map(int, input().split()))
c = []
s = sum(b)
for i in range(1, 6):
	if (i + s) % (a + 1) == 1:
		continue
	else:
		c.append(i)
print(len(c))


def arr_inp():
	return [int(x) for x in input().split()]
(n, arr) = (int(input()), arr_inp())
fingers = sum(arr) + 1
count = 0
for i in range(5):
	if fingers % (n + 1) != 1:
		count += 1
	fingers += 1
print(count)


n = int(input())
total = sum([int(i) for i in input().split()])
c = 0
for i in range(1, 6):
	if (total + i) % (n + 1) != 1:
		c += 1
print(c)


friends = int(input())
fingers = list(map(int, input().split()))
tot_fin = sum(fingers)
total_person = friends + 1
res = 0
for i in range(1, 6):
	if (tot_fin + i) % total_person != 1:
		res += 1
print(res)


n = int(input())
fin = input().split()
fin = [int(x) for x in fin]
total = sum(fin)
pos = total
n += 1
for i in range(5 * n, 5):
	if pos < 5:
		break
	else:
		pos -= 5
count = 0
for i in range(1, 6):
	pos += 1
	if pos == 1 or pos % n == 1:
		pass
	else:
		count += 1
print(count)


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
n = int(input())
a = list(map(int, input().split()))
people = n + 1
ans = 5
asum = sum(a)
for i in range(1, 6):
	if (asum + i) % people == 1:
		ans -= 1
print(ans)


fr_num = int(input())
fin_num = sum(map(int, input().split()))
c = 0
for i in range(1, 6):
	if (fin_num + i) % (fr_num + 1) != 1:
		c += 1
print(c)


n = int(input())
arr = list(map(int, input().split()))
s = sum(arr)
n += 1
count = 0
for i in range(1, 6):
	x = (s % n + i % n) % n
	if x != 1:
		count += 1
print(count)


n = int(input())
a = [int(x) for x in input().split()]
res = 0
n += 1
if (sum(a) + 1) % n != 1:
	res += 1
if (sum(a) + 2) % n != 1:
	res += 1
if (sum(a) + 3) % n != 1:
	res += 1
if (sum(a) + 4) % n != 1:
	res += 1
if (sum(a) + 5) % n != 1:
	res += 1
print(res)


n = int(input())
l = [int(i) for i in input().split()]
s = sum(l)
c = 0
do_list = []
for i in range(1, 1000, n + 1):
	do_list.append(i)
for i in range(s + 1, s + 6):
	if i in do_list:
		c += 1
print(5 - c)


n = int(input()) + 1
c = 0
a = [int(x) for x in input().split()]
for i in a:
	c += i
t = 0
for j in range(1, 6):
	if (c + j) % n != 1:
		t += 1
print(t)


x = int(input())
y = []
sum = 0
y = input().split()
for i in range(x):
	sum = sum + int(y[i])
count = 0
for j in range(1, 6):
	if (sum + j) % (x + 1) != 1:
		count = count + 1
print(count)


no_Friends = int(input())
total_fingers = sum(map(int, input().split()))
Dimas_finger = 0
for i in range(1, 6):
	if (total_fingers + i) % (no_Friends + 1) != 1:
		Dimas_finger += 1
print(Dimas_finger)


def calc(n, a):
	c = 0
	t = sum(a)
	for i in range(1, 6):
		if (i + t - 1) % (n + 1) != 0:
			c += 1
	return c
n = int(input())
a = list(map(int, input().split()))
print(calc(n, a))


friends = int(input())
fingers = input().split(' ')
fingers_count = 0
for x in fingers:
	fingers_count += int(x)
count = 0
for i in range(1, 6):
	if (i + fingers_count) % (friends + 1) != 1:
		count += 1
print(count)


n = int(input())
arr = list(map(int, input().split()))
tf = 0
for i in range(n):
	tf += arr[i]
i = tf + 1
c = 0
while i <= tf + 5:
	if i % (n + 1) == 1:
		c += 1
	i += 1
print(5 - c)


n = int(input())
l = list(map(int, input().split()))
t = sum(l)
p = []
for i in range(t + 1, t + 6):
	if i % (n + 1) != 1:
		r = i - t
		p.append(r)
print(len(p))


n = int(input())
a = list(map(int, input().split()))
k = sum(a)
count = 0
i = 1
while i < 6:
	m = (k + i) % (n + 1)
	if m == 1:
		count += 1
	i = i + 1
print(5 - count)


def f(l):
	n = len(l)
	s = sum(l)
	rl = [(s + i) % (n + 1) != 1 for i in range(1, 6)]
	return sum(rl)
_ = input()
l = list(map(int, input().split()))
print(f(l))


def solve(lst, n):
	pass
n = int(input())
lst = list(map(int, input().split(' ')))
s = sum(lst) - 1
ans = 0
n = n - 1
for i in range(1, 6):
	if (s + i) % (len(lst) + 1) == 0:
		continue
	ans += 1
print(ans)


n = int(input())
hands = list(map(int, input().split()))
possible_hands = []
for i in range(1, 6):
	total = sum(hands) + i
	if total % (n + 1) != 1:
		possible_hands.append(i)
print(len(possible_hands))


n = int(input())
fingers = sum([int(x) for x in input().split()])
total = 0
for a in range(1, 6):
	if (fingers + a - 1) % (n + 1) != 0:
		total += 1
print(total)


n = int(input()) + 1
nums = sum(list(map(int, input().split())))
res = 0
for i in [1, 2, 3, 4, 5]:
	if (nums + i) % n != 1:
		res += 1
print(res)


t = int(input())
ans = list(map(int, input().split()))
total = sum(ans)
l = len(ans) + 1
count = 0
for i in range(1, 6):
	if (total + i) % l != 1:
		count = count + 1
print(count)


import sys
n = int(input())
an = list(map(int, sys.stdin.readline().split()))
total = sum(an)
ans = 0
for i in range(1, 6):
	if (total + i) % (n + 1) != 1:
		ans += 1
print(ans)


tp = int(input()) + 1
n = sum(map(int, input().split()))
r = 0
for i in range(1, 6):
	if (n + i) % tp != 1:
		r += 1
print(r)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

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

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

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

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

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = iinp()
arr = lmp()
s = sum(arr)
poss = [s + i for i in range(1, 6)]
c = 0
for i in poss:
	c += i % (n + 1) != 1
print(c)


def getIn():
	return input().strip()
N = int(getIn())
N += 1
fingers = list(map(int, getIn().split(' ')))
tot = sum(fingers)
cnt = 0
for i in range(1, 5 + 1):
	if (tot + i) % N != 1:
		cnt += 1
print(cnt)


n = int(input())
L = [int(x) for x in input().split()]
s = sum(L)
ct = 0
for i in range(1, 6):
	if (s + i) % (n + 1) != 1:
		ct += 1
print(ct)


n = int(input())
x = list(map(int, input().split()))
g = sum(x)
r = []
for a in range(1, 6):
	if (g + a) % (n + 1) != 1:
		r.append(a)
print(len(r))


even = 2
odd = 3
no_friends = int(input()) + 1
people = [-1] * no_friends
fingers_count = [int(x) for x in input().split()]
total = sum(fingers_count)
ans = 0
for j in range(1, 6):
	temp = total
	temp += j
	if temp % no_friends != 1:
		ans += 1
print(ans)


n = int(input())
a = [int(i) for i in input().split()]
p = sum(a)
l = 0
for ll in range(1, 6):
	k = p + ll
	if k % (n + 1) != 1:
		l += 1
print(l)


n = int(input())
m = [int(x) for x in input().split()]
s = sum(m) - 1
w = 0
for i in range(1, 6):
	if (i + s) % (n + 1) > 0:
		w += 1
print(w)


N = int(input())
number = set([1, 2, 3, 4, 5])
arr = list(map(int, input().split()))
add = sum(arr)
cnt = 0
for x in number:
	if (add + x) % (N + 1) != 1:
		cnt += 1
print(cnt)


n = int(input())
arr = list(map(int, input().split()))
fin = sum(arr)
ways = 0
for i in range(1, 6):
	if (fin + i) % (n + 1) != 1:
		ways += 1
print(ways)


import sys
my_file = sys.stdin
friends = int(my_file.readline().strip('\n')) + 1
fingers = sum([int(i) for i in my_file.readline().split(' ')])
result = 0
for i in range(1, 6):
	if (i + fingers) % friends != 1:
		result += 1
print(result)


def gint():
	return int(input())

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

def gfloat():
	return float(input())

def gfloat_arr():
	return list(map(float, input().split()))
INF = 1 << 31
n = gint()
sum = sum(gint_arr())
res = 5
for i in range(1, 6):
	if (i + sum) % (n + 1) == 1:
		res -= 1
print(res)


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.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 = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.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:
			self.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 get_int():
	return int(input())

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

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().split(' ')

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a, drop_zero=False):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	if drop_zero:
		return p[1:]
	else:
		return p

def prefix_mins(a, drop_zero=False):
	p = [float('inf')]
	for x in a:
		p.append(min(p[-1], x))
	if drop_zero:
		return p[1:]
	else:
		return p

def solve_a():
	n = get_int()
	x = get_ints()
	S = sum(x)
	return sum([(S + f) % (n + 1) != 1 for f in range(1, 6)])
print(solve_a())


n = int(input())
nums = list(map(int, input().split()))
sol = 0
numSum = sum(nums)
for i in range(1, 6):
	if (numSum + i) % (n + 1) != 1:
		sol += 1
print(sol)


n = int(input())
a = list(map(int, input().split()))
x = 0
i = -1
m = 0
while x <= sum(a) - 1:
	if i == n:
		i = 0
	else:
		i = i + 1
	x = x + 1
j = i
l = []
for k in range(1, n + 2):
	l.append(k)
l[0] = -100
for o in range(1, 6):
	j = i
	for t in range(j, j + o):
		if j == n:
			j = 0
		else:
			j = j + 1
	if l[j] != -100:
		m = m + 1
print(m)


n = int(input())
l1 = [int(x) for x in input().split()]
k = sum(l1)
n += 1
current = k
i = 0
ans = 0
while i < 5:
	current += 1
	if current % n != 1:
		ans += 1
	i += 1
print(ans)


n = int(input())
arr = list(map(int, input().split()))
n = n + 1
s = sum(arr)
c = 0
for i in range(5):
	s += 1
	k = s % n
	if k - 1 != 0:
		c += 1
print(c)


from sys import stdin, stdout
from collections import Counter

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

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

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
from math import ceil
n = ip()
li = ai()
sumoffriends = sum(li)
ans = 5
x = n + 1
for i in range(1, 6):
	if (i + sumoffriends - 1) % x == 0:
		ans -= 1
op(ans)


n = int(input())
a = [int(x) for x in input().split()]
sum = 0
for e in a:
	sum += e
count = 0
for i in range(1, 6):
	if (sum + i) % (n + 1) != 1:
		count += 1
print(count)


no_friends = int(input()) + 1
people = [-1] * no_friends
fingers_count = [int(x) for x in input().split()]
total = sum(fingers_count)
ans = 0
for j in range(1, 6):
	temp = total
	temp += j
	if temp % no_friends != 1:
		ans += 1
print(ans)


n = int(input())
A = list(map(int, input().split()))
Cnt = sum(A)
y = 1 == (Cnt + 1) % (n + 1)
y += 1 == (Cnt + 2) % (n + 1)
y += 1 == (Cnt + 3) % (n + 1)
y += 1 == (Cnt + 4) % (n + 1)
y += 1 == (Cnt + 5) % (n + 1)
print(5 - y)


t = int(input())
t = t + 1
l = list(map(int, input().split()))
p = sum(l)
z = []
for i in range(1, 6):
	if (p + i - 1) % t == 0:
		pass
	else:
		z.append(i)
print(len(z))


n = int(input())
s = list(map(int, input().split()))
k = 0
kk = 0
for i in range(n):
	k += s[i]
for i in range(1, 6):
	if (k + i) % (n + 1) != 1:
		kk += 1
print(kk)