Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of $360$ degrees and a pointer which initially points at zero:

 [Image] 

Petr called his car dealer, who instructed him to rotate the lock's wheel exactly $n$ times. The $i$-th rotation should be $a_i$ degrees, either clockwise or counterclockwise, and after all $n$ rotations the pointer should again point at zero.

This confused Petr a little bit as he isn't sure which rotations should be done clockwise and which should be done counterclockwise. As there are many possible ways of rotating the lock, help him and find out whether there exists at least one, such that after all $n$ rotations the pointer will point at zero again.


-----Input-----

The first line contains one integer $n$ ($1 \leq n \leq 15$) — the number of rotations.

Each of the following $n$ lines contains one integer $a_i$ ($1 \leq a_i \leq 180$) — the angle of the $i$-th rotation in degrees.


-----Output-----

If it is possible to do all the rotations so that the pointer will point at zero after all of them are performed, print a single word "YES". Otherwise, print "NO". Petr will probably buy a new car in this case.

You can print each letter in any case (upper or lower).


-----Examples-----
Input
3
10
20
30

Output
YES

Input
3
10
10
10

Output
NO

Input
3
120
120
120

Output
YES



-----Note-----

In the first example, we can achieve our goal by applying the first and the second rotation clockwise, and performing the third rotation counterclockwise.

In the second example, it's impossible to perform the rotations in order to make the pointer point at zero in the end.

In the third example, Petr can do all three rotations clockwise. In this case, the whole wheel will be rotated by $360$ degrees clockwise and the pointer will point at zero again.

Difficulty: EASY
Tags: Dynamic programming

Bit manipulation

Complete search
Skill types: Dynamic programming

Bit manipulation

Complete search

Starter code:

Solutions:
int_inp = lambda : int(input())
strng = lambda : input().strip()
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
import math
from collections import Counter, defaultdict
m = int_inp()
p = []
for i in range(m):
	p.append(int_inp())
x = 'no'
q = len(bin(2 ** m)[2:])
for i in range(0, 2 ** m):
	a = p[:]
	binary1 = list(bin(i)[2:])
	if len(binary1) < q:
		binary1 = ['0'] * (q - len(binary1)) + binary1
	l = 0
	for (k, j) in zip(a, binary1):
		if j == '1':
			a[l] = -1 * a[l]
		l += 1
	if sum(a) == 0 or sum(a) % 360 == 0:
		x = 'yes'
		break
print(x)


n = int(input())
a = [0]
for i in range(n):
	m = int(input())
	s = []
	for j in a:
		s.append(j + m)
		s.append(j - m)
	a = s
flag = 0
for i in a:
	if i % 360 == 0:
		print('YES')
		flag = 1
		break
if flag == 0:
	print('NO')


n = int(input())
options = []
for i in range(n):
	a = int(input())
	if i == 0:
		options += [a]
	else:
		length = len(options)
		for b in range(length):
			options += [options[b] - a]
			options[b] += a
for c in options:
	if c % 360 == 0:
		print('YES')
		exit()
print('NO')


def lock(ar, i, sm, n):
	if i == n:
		if sm == 0 or sm % 360 == 0:
			return True
		return False
	return lock(ar, i + 1, sm + ar[i], n) | lock(ar, i + 1, sm - ar[i], n)
n = int(input())
ar = []
for i in range(n):
	ar.append(int(input()))
b = lock(ar, 0, 0, n)
if b == False:
	print('NO')
else:
	print('YES')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
a = sorted(a)
s = [0]
k = 1
for i in a:
	s1 = []
	for j in range(k):
		s1.append(s[j] + i)
		s1.append(s[j] - i)
	k *= 2
	s = s1
s = [i % 360 for i in s]
if 0 in s:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(input()) for i in range(n)]

def rec(s, a, i):
	if i == len(a):
		return s % 360 == 0
	return rec((s + a[i]) % 360, a, i + 1) or rec((s - a[i]) % 360, a, i + 1)
print('YES' if rec(0, a, 0) else 'NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
s = []
s.append(l[0])
check = 0
for i in range(1, n):
	for j in range(2 ** (i - 1) - 1, 2 ** i - 1):
		x = (s[j] + l[i]) % 360
		y = (s[j] - l[i]) % 360
		if (x == 0 or y == 0) and i == n - 1:
			check = 1
			break
		s.append(x)
		s.append(y)
if check:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
for i in range(1 << n):
	x = 0
	for num in range(n):
		if i & 1 << num:
			x += a[num]
		else:
			x -= a[num]
	if x % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
l = [0]
g = 0
for i in range(n):
	l = l + l
	x = int(input())
	for j in range(len(l) // 2):
		l[j] += x
	for j in range(len(l) // 2, len(l)):
		l[j] -= x
for i in range(len(l)):
	if l[i] % 360 == 0:
		g = 1
		break
if g == 1:
	print('YES')
else:
	print('NO')


def isvalid(arr, i, n, s):
	if i == n:
		return s % 360 == 0
	else:
		ans = isvalid(arr, i + 1, n, s + arr[i]) or isvalid(arr, i + 1, n, s - arr[i])
		return ans
n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
ans = isvalid(arr, 1, n, arr[0])
print('YES' if ans else 'NO')


n = int(input())
arr = []
for _ in range(n):
	arr.append(int(input()))
p = False
for i in range(0, (1 << n) - 1):
	sum = 0
	for j in range(0, n):
		if i & 1 << j:
			sum += arr[j]
			sum %= 360
		else:
			sum -= arr[j]
			sum %= 360
	if sum % 360 == 0:
		p = True
if p:
	print('YES')
else:
	print('NO')


arr = []
a = int(input())
for _ in range(a):
	arr.append(int(input()))
total = sum(arr)
flag = 0
for i in range(2 ** a):
	x = 0
	s = '0' * (a - len(bin(i)[2:])) + bin(i)[2:]
	for j in range(a):
		if s[j] == '1':
			x -= arr[j]
		else:
			x += arr[j]
	if x % 360 == 0:
		flag = 1
		break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))

def rec(arr, i, add):
	if i == n:
		if add % 360 == 0:
			return True
		else:
			return False
	return rec(arr, i + 1, add + arr[i]) or rec(arr, i + 1, add - arr[i])
print('YES' if rec(arr, 0, 0) else 'NO')


def recur(degrees, sum_deg, n, num):
	if sum_deg % 360 == 0 and n == num + 1:
		return True
	for i in degrees:
		if recur(degrees[1:], sum_deg + i, n + 1, num):
			return recur(degrees[1:], sum_deg + i, n + 1, num)
		else:
			return recur(degrees[1:], sum_deg - i, n + 1, num)
	return False
num = int(input())
i = 0
sum_deg = 0
n = 1
degrees = []
while i < num:
	degrees.append(int(input()))
	i += 1
if recur(degrees, sum_deg, n, num):
	print('YES')
else:
	print('NO')


def summator(I: list, O=None):
	O = O or []
	if len(I) == 0:
		smm = 0
		for r1 in O:
			smm = smm + r1
		if smm % 360 == 0:
			return True
		return False
	O.append(I[0])
	if summator(I[1:], O):
		return True
	O[-1] = -1 * O[-1]
	if summator(I[1:], O):
		return True
	O.pop()
N = int(input())
A = []
for _ in range(N):
	A.append(int(input()))
sm = 0
for i in A:
	sm = sm + i
sm = sm % 360
if N == 1:
	print('NO')
elif sm == 0:
	print('YES')
elif summator(A) == True:
	print('YES')
else:
	print('NO')


n = int(input())
nums = []
for _ in range(n):
	num = int(input())
	nums.append(num)

def check(nums, total, i):
	if i == len(nums):
		if total % 360 == 0 or total == 0:
			return 'YES'
		else:
			return 'NO'
	res1 = check(nums, total + nums[i], i + 1)
	res2 = check(nums, total - nums[i], i + 1)
	if res2 == 'YES' or res1 == 'YES':
		return 'YES'
	else:
		return 'NO'
print(check(nums, 0, 0))


def f(_array):
	for i in array:
		if i % 360 == 0:
			return 'YES'
	return 'NO'
n = input()
array = [int(input())]
for i in range(int(n) - 1):
	b = array
	array = []
	a = int(input())
	for j in b:
		array += [j + a, j - a]
print(f(array))


a = [0] * 2701
n = int(input())
a[0] = 1
s = 0
for i in range(n):
	d = int(input())
	s += d
	b = a[:]
	for j in range(len(a)):
		if a[j] == 1:
			if j + d <= len(b) - 1:
				b[j + d] = 1
	a = b[:]
	a[d] = 1
for i in range(min(s + 1, 2701)):
	if a[i] == 1:
		if s % 360 == 0 or (max(i, s - i) - min(i, s - i)) % 360 == 0:
			print('YES')
			break
else:
	print('NO')


import sys
n = int(input())
tab = [0]
for i in range(n):
	newtab = []
	new = int(input())
	for j in tab:
		newtab.append(j + new)
		newtab.append(j - new)
	tab = newtab
for i in tab:
	if i % 360 == 0:
		print('YES')
		sys.exit()
print('NO')


def r(a, n, sm):
	if n == -1:
		if sm % 360 == 0:
			return True
		else:
			return False
	else:
		return r(a, n - 1, sm - a[n]) or r(a, n - 1, sm + a[n])
n = int(input())
a = []
sm = 0
for i in range(n):
	a.append(int(input()))
if r(a, n - 1, 0):
	print('YES')
else:
	print('NO')


def f(a, i):
	if i == n:
		return a % 360 == 0
	return f(a - ls[i], i + 1) or f(a + ls[i], i + 1)
n = int(input())
ls = [int(input()) for _ in '0' * n]
print('YNEOS'[not f(0, 0)::2])


def answer(n, a):
	for j in range(0, 2 ** n):
		summ = 0
		bj = bin(j)[2:].zfill(n)
		for i in range(n):
			if bj[i] == '0':
				summ += a[i]
			else:
				summ -= a[i]
		if summ % 360 == 0:
			return 'YES'
	return 'NO'

def main():
	n = int(input())
	a = []
	for j in range(n):
		a.append(int(input()))
	print(answer(n, a))
	return
main()


n = int(input())
a = [0]
for i in range(n):
	cur = int(input())
	to = []
	for num in a:
		to.append(num + cur)
		to.append(num - cur)
	a = to
for i in a:
	if i % 360 == 0:
		print('YES')
		exit()
print('NO')


import sys
import math
from collections import defaultdict

def getInputFromLine():
	return [int(x) for x in input().split()]
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass

def isSumZero(queue, s, n):
	if n <= 0 and s % 360 == 0:
		return True
	elif n <= 0:
		return False
	item = queue[n - 1]
	s += item
	if isSumZero(queue, s, n - 1):
		return True
	s -= item
	s -= item
	if isSumZero(queue, s, n - 1):
		return True
n = int(input())
numbers = []
for i in range(n):
	t = int(input())
	numbers.append(t)
if isSumZero(numbers, 0, n):
	print('YES')
else:
	print('NO')


a = int(input())
b = []
suot = 0
flag = True
for i in range(a):
	vvod = int(input())
	suot -= vvod
	b.append(vvod)
c = 2 ** a
st = []
for i in range(c):
	for j in range(a):
		st.append(i % 2)
		i //= 2
	st = st[::-1]
	su = suot
	for i in range(a):
		su += b[i] * 2 * st[i]
	if su % 360 == 0:
		print('YES')
		flag = False
		break
	st = []
if flag:
	print('NO')


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	a = [int(input()) for _ in range(n)]
	for x in range(2 ** n + 1):
		p = 0
		for i in range(n):
			p += a[i] if x >> i & 1 else -a[i]
			p %= 360
		if p == 0:
			print('YES')
			return
	print('NO')
main()


import sys
input = sys.stdin.readline
n = int(input())
A = [int(input()) for i in range(n)]
NOW = [0]
for a in A:
	NEXT = []
	for n in NOW:
		NEXT.append((n + a) % 360)
		NEXT.append((n - a) % 360)
	NOW = list(set(NEXT))
if 0 in NOW:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
n = int(cin())
x = [0, 0]
for i in range(1, n + 1):
	y = int(cin())
	f = 0
	for j in range(2 ** (i - 1), 2 ** i):
		x.append((x[j] - y) % 360)
		x.append((x[j] + y) % 360)
		if (x[j] - y) % 360 == 0 or (x[j] + y) % 360 == 0:
			f = 1
if f:
	cout('yes\n')
else:
	cout('no\n')


def main():
	n = int(input())
	ki = []
	for _ in range(n):
		ki.append(int(input()))
	variants = 2 ** n
	for i in range(variants):
		s = 0
		for j in range(len(ki)):
			if i & 1 << j != 0:
				s += ki[j]
			else:
				s += -ki[j]
		if s % 360 == 0:
			print('YES')
			return
	print('NO')
main()


n = int(input())
a = [int(input()) for i in range(n)]
good = False
for mask in range(1 << n):
	cur = 0
	for bit in range(n):
		if mask & 1 << bit:
			cur += a[bit]
		else:
			cur -= a[bit]
		cur = (cur + 360) % 360
	if cur == 0:
		good = True
print('YES' if good else 'NO')


n = int(input())
a = [0]
for i in range(n):
	m = int(input())
	new = []
	for j in a:
		new.extend([j + m, j - m])
	a = new[:]
if any((c % 360 == 0 for c in a)):
	print('YES')
else:
	print('NO')


def f(k, s):
	if k == n:
		return not s % 360
	else:
		return f(k + 1, s + a[k]) or f(k + 1, s - a[k])
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
print('YES' if f(0, 0) else 'NO')


n = int(input())
f = {0: [0]}
for i in range(n):
	x = int(input())
	f[i + 1] = []
	for a in f[i]:
		f[i + 1].append((a + x) % 360)
		f[i + 1].append((a - x) % 360)
if 0 in f[n]:
	print('YES')
else:
	print('NO')


n = int(input())
a = [0]
f = 0
for i in range(n):
	x = int(input())
	b = []
	for j in a:
		b.append(j + x)
		b.append(j - x)
	a = b
for j in a:
	if j % 360 == 0:
		print('YES')
		f = 1
		break
if f == 0:
	print('NO')


n = int(input())
l = [0]
for i in range(n):
	a = int(input())
	l2 = []
	for x in l:
		l2.extend([x + a, x - a])
	l = l2
count = 0
for i in l:
	if i % 360 == 0:
		break
	else:
		count += 1
if count == len(l):
	print('NO')
else:
	print('YES')


n = int(input())
rot = []
add = 0
for i in range(0, n):
	rot.append(int(input()))
	add += rot[-1]
if add % 360 == 0:
	print('YES')
else:
	dp = [[0 for i in range(0, add + 1)] for j in range(0, n + 1)]
	rot.sort()
	for i in range(0, n + 1):
		dp[i][0] = 1
	done = False
	for i in range(1, n + 1):
		for j in range(1, add + 1):
			if j - rot[i - 1] >= 0:
				dp[i][j] = dp[i - 1][j] or dp[i - 1][j - rot[i - 1]]
			else:
				dp[i][j] = dp[i - 1][j]
			if dp[i][j] == 1:
				other_half = add - j
				if other_half % 360 - j % 360 == 0:
					done = True
					break
		if done == True:
			break
	if done == True:
		print('YES')
	else:
		print('NO')


n = int(input())
answers = [0]
for i in range(n):
	nextCombo = int(input())
	tempAnswer = []
	for answer in answers:
		tempAnswer.append((answer + nextCombo) % 360)
		tempAnswer.append((answer - nextCombo) % 360)
	answers = tempAnswer
if 0 in answers:
	print('YES')
else:
	print('NO')


from math import log2
n = int(input())
a = []
for i in range(n):
	k = int(input())
	a.append(k)
k = n
d = []
for i in range(0, 2 ** k):
	l = bin(i)[2:]
	su = 0
	if len(l) < k:
		l = '0' * (k - len(l)) + l
	le = list(l)
	for i in range(k):
		if le[i] == '0':
			su += a[i]
		else:
			su -= a[i]
	d.append(su % 360)
if d.count(0) != 0:
	print('YES')
else:
	print('NO')


from itertools import *
from operator import *
n = int(input())
d = [int(input()) for _ in range(n)]
flag = False
x = product([-1, 1], repeat=n)
for f in x:
	y = sum(map(mul, f, d))
	if y % 360 == 0:
		flag = True
		break
print('YES' if flag else 'NO')


def func(i, arr, ans):
	if i == len(arr):
		if ans % 360 == 0:
			return 'YES'
		else:
			return 'NO'
	if func(i + 1, arr, ans + arr[i]) == 'YES':
		return 'YES'
	if func(i + 1, arr, ans - arr[i]) == 'YES':
		return 'YES'
	return 'NO'
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
print(func(0, a, 0))


v = False

def dfs(x, deg):
	if x == n:
		if abs(deg) % 360 == 0:
			global v
			v = True
		return
	dfs(x + 1, deg + a[x])
	dfs(x + 1, deg - a[x])
n = int(input())
a = list()
for i in range(0, n):
	x = int(input())
	a.append(x)
dfs(0, 0)
if v:
	print('YES')
else:
	print('NO')


import sys

def getlarge(n):
	largest = ''
	for i in range(n):
		largest = largest + '1'
	return int(largest, 2)

def f(ang):
	largest = getlarge(len(ang))
	total = []
	for index in range(largest + 1):
		binary = bin(index)[2:]
		if len(binary) < len(ang):
			new = len(ang) - len(binary)
			for k in range(new):
				binary = '0' + binary
		total.append(0)
		for (i, char) in enumerate(binary):
			if char == '0':
				total[index] += ang[i]
			else:
				total[index] -= ang[i]
	return [el % 360 for el in total]
n = int(input())
ang = []
for i in range(n):
	ang.append(int(input()))
total = f(ang)
if 0 in total:
	print('YES')
else:
	print('NO')


def generate_signs(number, bits):
	signs = bits * [0]
	index = bits - 1
	while number > 0:
		rem = number % 2
		signs[index] = rem
		number = number // 2
		index -= 1
	return signs

def check(no_rotations, degrees):
	for i in range(2 ** (no_rotations - 1)):
		signs = generate_signs(i, no_rotations)
		rez = 0
		for (index, angle) in enumerate(degrees):
			if signs[index] == 0:
				rez -= angle
			else:
				rez += angle
		if rez % 360 == 0:
			print('YES')
			return
	print('NO')
	return
no_rotations = int(input())
degrees = []
for i in range(no_rotations):
	degrees.append(int(input()))
check(no_rotations, degrees)


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))

def rec(u, k):
	if u == n + 1:
		if k == 0:
			print('YES')
			exit()
		return
	rec(u + 1, (k - a[u - 1]) % 360)
	rec(u + 1, (k + a[u - 1]) % 360)
rec(1, 0)
print('NO')


n = int(input())
A = [int(input()) for i in range(n)]
B = [0] * n

def tick():
	for i in range(n):
		B[i] = 1 - B[i]
		if B[i] == 1:
			break
Stot = sum(A)
for i in range(2 ** n):
	S = sum((A[i] for i in range(n) if B[i]))
	if (Stot - S) % 360 == S % 360:
		print('YES')
		break
	tick()
else:
	print('NO')


n = int(input())
a = [int(input()) for i in range(n)]
s = set([0])
for x in a:
	ns = set()
	for y in s:
		ns.add((y + x) % 360)
		ns.add((y - x) % 360)
	s = ns
print('YES' if sum([y % 360 == 0 for y in s]) > 0 else 'NO')


sols = [0]
n = 1
t = int(input())
for _ in range(t):
	num = int(input())
	for i in range(n):
		sols.append(sols[i] + num)
		sols[i] -= num
	n *= 2
for e in sols:
	if e == 0 or e % 360 == 0:
		print('YES')
		exit()
print('NO')


import itertools
import sys
n = int(input())
lst = [list(i) for i in itertools.product([0, 1], repeat=n)]
a = []
for i in range(n):
	a.append(int(input()))
c = 0
for i in range(len(lst)):
	m = 0
	for k in range(n):
		if lst[i][k] == 0:
			m += -a[k]
		else:
			m += a[k]
	if m % 360 == 0:
		c = 1
		break
if c == 1:
	print('YES')
else:
	print('NO')


C1 = 2 ** 360
C2 = 2 ** 360 - 1
x = 1
for _ in range(int(input())):
	a = int(input())
	x = x << a | x << 360 - a
	x = (x | x // C1) & C2
if x % 2:
	print('YES')
else:
	print('NO')


from sys import exit

def nextperm(lst):
	for i in range(len(lst) - 1, 0, -1):
		if lst[i - 1] < lst[i]:
			for j in range(len(lst) - 1, i - 1, -1):
				if lst[i - 1] < lst[j]:
					return lst[:i - 1] + lst[j:j + 1] + lst[:j:-1] + lst[i - 1:i] + lst[j - 1:i - 1:-1]

def find_poss(num_t, num_f):
	curr = '0' * num_f + '1' * num_t
	prev = 'chert'
	while curr:
		curr_poss = 0
		for i in range(len(a)):
			m = 1
			if curr[i] == '0':
				m = -1
			curr_poss += a[i] * m
		if curr_poss % 360 == 0:
			print('YES')
			exit(0)
		prev = curr
		curr = nextperm(prev)
		if curr is None or curr == prev:
			break
n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
num_t = n
num_f = 0
while num_t != -1:
	find_poss(num_t, num_f)
	num_t -= 1
	num_f += 1
print('NO')


n = int(input())
v = [0] * n
for i in range(n):
	v[i] = int(input())
done = False
for i in range(2 ** (n - 1)):
	a = bin(i)[:1:-1]
	a += '0' * (n - 1 - len(a))
	sumi = v[-1]
	for i in range(n - 1):
		if a[i] == '1':
			sumi += v[i]
		else:
			sumi -= v[i]
	if sumi % 360 == 0:
		print('YES')
		done = True
		break
if not done:
	print('NO')


array = [0]
for _ in range(int(input())):
	broken = int(input())
	tiger = []
	for i in array:
		tiger.append(i - broken)
		tiger.append(i + broken)
	array = tiger
for i in array:
	if i == 0 or i % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
l2 = [0]
for i in range(0, n):
	x = int(input())
	y = len(l2)
	for i in range(0, y):
		l2.append(l2[i] - x)
		l2.append(l2[i] + x)
	l2 = l2[y:]
flag = 0
for item in l2:
	if item % 360 == 0:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


n = int(input())
ar = []
s = 0
for i in range(n):
	ar.append(int(input()))
	s += ar[-1]
if s % 360 == 0:
	print('YES')
else:
	a = 1 << n
	for i in range(a):
		su = 0
		for j in range(n):
			if 1 << j & i:
				su += ar[j]
			else:
				su -= ar[j]
		if su % 360 == 0:
			print('YES')
			break
	else:
		print('NO')


n = int(input())
degree = []
for _ in range(n):
	degree.append(int(input()))
for comb in range(2 ** n):
	s = bin(comb)[2:]
	l = len(s)
	s = '0' * (n - l) + s
	sm = 0
	for idx in range(n):
		sm = [sm - degree[idx], sm + degree[idx]][int(s[idx])]
	if not sm % 360:
		print('YES')
		break
if comb == 2 ** n - 1:
	print('NO')


from collections import deque
N = int(input())
k = 0
ans = 0
D = []
Sum = 0
q = deque()
q.append((0, Sum))
next_q = deque()
for i in range(N):
	D.append(int(input()))
while k != N:
	p = len(q)
	for i in range(p):
		(a, b) = q.popleft()
		next_q.append((a + 1, b + D[a]))
		next_q.append((a + 1, b - D[a]))
	q = next_q
	next_q = deque()
	k += 1
for i in q:
	if i[1] % 360 == 0:
		ans += 1
if ans == 0:
	print('NO')
else:
	print('YES')


def rec(pos):
	global a, n, c, f
	if f:
		if pos >= n:
			s = 0
			for i in range(n):
				s += a[i] * c[i]
			if s % 360 == 0:
				print('YES')
				f = False
		else:
			for i in range(2):
				x = 1
				if i == 0:
					x = -1
				a[pos] = x
				rec(pos + 1)
n = int(input())
a = [0] * n
f = True
c = []
for i in range(n):
	c.append(int(input()))
rec(0)
if f:
	print('NO')


n = int(input())
values = [int(input()) for _ in range(n)]
all_sum = sum(values)
success_flag = False
if all_sum % 360 == 0:
	success_flag = True
else:
	for count in range(0, 2 ** len(values)):
		local_list = []
		local_value = all_sum
		for bit in range(0, len(values)):
			if 2 ** bit & count > 0:
				local_value -= 2 * values[bit]
		if local_value % 360 == 0:
			success_flag = True
			break
print('YES' if success_flag else 'No')


can = False

def f(temp, summ, step):
	global can
	if abs(summ) % 360 == 0 and step == 0:
		can = True
	if step == -1:
		return
	step -= 1
	f(temp, summ + temp[step], step)
	f(temp, summ - temp[step], step)
temp = []
count = int(input())
for i in range(count):
	temp.append(int(input()))
f(temp, 0, count)
print('YES' if can else 'NO')


def main():
	count = int(input())
	arr = []
	for x in range(count):
		arr.append(int(input()))
	store = [0]
	for x in arr:
		duplicate = []
		for y in store:
			duplicate.append((y + x) % 360)
			duplicate.append((y - x) % 360)
		store = duplicate.copy()
	if 0 in store:
		print('YES')
	else:
		print('NO')
main()


def subs(l):
	if l == []:
		return [[]]
	x = subs(l[1:])
	return x + [[l[0]] + y for y in x]
n = int(input())
l = [int(input()) for _ in range(n)]
l.sort(reverse=True)
(subsets, total) = (sorted(subs(l[1:]), reverse=True), sum(l))
for sub in subsets:
	if not (total - 2 * sum(sub)) % 360:
		print('YES')
		break
else:
	print('NO')


import re
import sys
exit = sys.exit
from bisect import bisect_left as bsl, bisect_right as bsr
from collections import Counter, defaultdict as ddict, deque
from functools import lru_cache
cache = lru_cache(None)
from heapq import *
from itertools import *
from math import inf
from pprint import pprint as pp
enum = enumerate
ri = lambda : int(rln())
ris = lambda : list(map(int, rfs()))
rln = sys.stdin.readline
rl = lambda : rln().rstrip('\n')
rfs = lambda : rln().split()
cat = ''.join
catn = '\n'.join
mod = 1000000007
d4 = [(0, -1), (1, 0), (0, 1), (-1, 0)]
d8 = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)]
n = ri()
a = [ri() for _ in range(n)]
for i in range(1 << n):
	deg = 0
	for j in range(n):
		if i & 1 << j:
			deg += a[j]
		else:
			deg -= a[j]
	if deg % 360 == 0:
		print('YES')
		exit()
print('NO')


def sol(start, n, arr, res, sum):
	if start == n:
		return
	for i in range(start, n):
		temp = sum - arr[i] * 2
		res.append(temp)
		sol(i + 1, n, arr, res, temp)
n = int(input())
arr = []
sum = 0
for i in range(0, n):
	temp = int(input())
	arr.append(temp)
	sum = sum + temp
res = []
res.append(sum)
sol(0, len(arr), arr, res, res[0])
check = False
for i in range(0, len(res)):
	if res[i] == 0 or res[i] % 360 == 0:
		check = True
		break
if check == False:
	print('NO')
else:
	print('YES')


t = int(input())
num = []
for i in range(t):
	n = int(input())
	num.append(n)
flag = 0
for i in range(pow(2, t) - 1):
	k = i
	sum = 0
	for j in range(t):
		if k % 2 == 0:
			sum += num[j]
		else:
			sum -= num[j]
		k = k // 2
	if sum % 360 == 0:
		flag = 1
		break
if flag:
	print('YES')
else:
	print('NO')


import math

def printSubsequences(arr, n):
	global s
	b = 0
	opsize = math.pow(2, n)
	for counter in range(1, int(opsize)):
		b = 0
		for j in range(0, n):
			if counter & 1 << j:
				b += arr[j]
		s.append(b)
	return s
s = []
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
s = printSubsequences(a, n)
su = sum(a)
c = 1
if su % 360 == 0:
	print('YES')
	c = 0
for i in range(len(s)):
	if (2 * s[i] - su) % 360 == 0 and c == 1:
		print('YES')
		c = 0
		break
if c == 1:
	print('NO')


import math as mt
import sys, 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 = I()
l = [I()]
q = l[:]
for i in range(n - 1):
	d = I()
	q = []
	for j in l:
		q.append((j + d) % 360)
		q.append((j - d) % 360)
	l = q[:]
if q.count(0) > 0 or q.count(360) > 0:
	print('YES')
else:
	print('NO')


n = int(input())
pov = []
for l in range(n):
	pov.append(int(input()))
m = 0
mask = bin(m)[2:].zfill(n)
while mask != '1' * n:
	c = 0
	mask = str(bin(m)[2:].zfill(n))
	for i in range(n):
		if mask[i] == '0':
			c += pov[i]
		else:
			c -= pov[i]
	if c % 360 == 0:
		print('YES')
		raise SystemExit
	m += 1
print('NO')


n = int(input())
a = []
c = False
for i in range(n):
	a.append(int(input()))
for i in range(2 ** n):
	string = (n - len(bin(i)[2:])) * '0' + bin(i)[2:]
	summ = 0
	for i in range(n):
		if string[i] == '0':
			summ += a[i]
		else:
			summ -= a[i]
	if summ % 360 == 0:
		print('YES')
		c = True
		break
if not c:
	print('NO')


n = int(input())
a = []
ans = 0
for _ in range(n):
	x = int(input())
	a.append(x)
for i in range(2 ** n):
	ans = 0
	c = 0
	for j in range(n):
		if i & 1 << j:
			ans += a[j]
		else:
			ans -= a[j]
	if ans % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
A = [int(input()) for _ in range(n)]

def rotate(a, n):
	if n == len(A):
		return a % 360 == 0
	if rotate(a + A[n], n + 1):
		return True
	else:
		return rotate(a - A[n], n + 1)
print('YES' if rotate(0, 0) else 'NO')


def main():
	n = int(input())
	mv = [0]
	for i in range(0, n):
		mv.append(int(input()))
	r = rotate(n, 0, mv, {})
	if r:
		print('YES')
	else:
		print('NO')
	return 0

def rotate(idx, sm, arr, dp):
	if idx == 0:
		if sm == 0 or (sm + 5400) % 360 == 0:
			return True
		return False
	if idx < 0:
		return False
	if (idx, sm) in dp:
		return dp[idx, sm]
	rs = rotate(idx - 1, sm - arr[idx], arr, dp) or rotate(idx - 1, sm + arr[idx], arr, dp)
	dp[idx, sm] = rs
	return rs
main()


import itertools
try:
	n = int(input())
	l = []
	for i in range(0, n):
		p = int(input())
		l.append(p)
	p = 0
	s = sum(l)
	o = list(range(n))
	for i in range(1, n):
		y = 0
		x = 0
		for j in itertools.combinations(o, i):
			j = list(j)
			x = 0
			y = 0
			for i in range(0, n):
				if i in j:
					x += l[i]
				else:
					y += l[i]
			if abs(x - y) % 360 == 0:
				p = 1
				break
	if p == 1 or s % 360 == 0:
		print('YES')
	else:
		print('NO')
except:
	pass


n = int(input())
d = {0}
for i in range(n):
	a = int(input())
	s = set()
	for j in d:
		s.add((j + a) % 360)
		s.add((j - a) % 360)
	d = s
if 0 in d:
	print('YES')
else:
	print('NO')


import sys
sys.setrecursionlimit(33000)

def can_unlock(s, i, arr):
	if i == len(arr) - 1:
		return (s + arr[i]) % 360 == 0 or (s - arr[i]) % 360 == 0
	return can_unlock(s + arr[i], i + 1, arr) or can_unlock(s - arr[i], i + 1, arr)
n = int(input())
arr = [None] * n
for i in range(n):
	arr[i] = int(input())
if can_unlock(0, 0, arr):
	print('YES')
else:
	print('NO')


def testa(ang, cont):
	a = [cont]
	b = [cont]
	if len(ang) > 0:
		a = testa(ang[1:], cont + ang[0])
		b = testa(ang[1:], cont - ang[0])
	if a == b:
		p = list(a)
	else:
		p = list(a) + list(b)
	return p
n = int(input())
ang = []
for i in range(n):
	ang.append(int(input()))
ang.sort()
p = testa(ang, 0)
o = 0
for i in p:
	if i % 360 == 0:
		o = 1
		break
if o == 1:
	print('YES')
else:
	print('NO')


n = int(input())
z = []
q = 0
for i in range(n):
	v = int(input())
	q += v
	z.append(v)

def subsetsum(array, num):
	if num == 0 or num < 1:
		return None
	elif len(array) == 0:
		return None
	elif array[0] == num:
		return [array[0]]
	else:
		with_v = subsetsum(array[1:], num - array[0])
		if with_v:
			return [array[0]] + with_v
		else:
			return subsetsum(array[1:], num)

def can_rotate(arr, i=0, cur=0):
	cur %= 360
	if i >= len(arr):
		return cur == 0
	return can_rotate(arr, i + 1, cur + arr[i]) or can_rotate(arr, i + 1, cur - arr[i])
if can_rotate(z):
	print('YES')
else:
	print('NO')


import itertools
n = int(input())
lst = list(itertools.product([True, False], repeat=n - 1))
angles = []
for i in range(n):
	a = int(input())
	angles.append(a)

def sum(ops, vec):
	result = vec[0]
	veclen = len(vec)
	opslen = len(ops)
	for i in range(1, veclen):
		if ops[i - 1]:
			result += vec[i]
		else:
			result -= vec[i]
	return result
flag = 0
for operators in lst:
	res = sum(operators, angles)
	res = res % 360
	if res == 0:
		flag = 1
		break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
a = [0] * n
for i in range(n):
	a[i] = int(input())
for mask in range(1 << n):
	rot = 0
	for i in range(n):
		if mask & 1 << i != 0:
			rot += a[i]
		else:
			rot -= a[i]
	if rot % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
temp = [0]
k = False
for i in range(n):
	num = int(input())
	z = []
	for tempnum in temp:
		z.append(tempnum + num)
		z.append(tempnum - num)
	temp = z
for y in z:
	if y % 360 == 0:
		k = True
if k:
	print('YES')
else:
	print('NO')


import itertools
N = int(input())
A = [int(input()) for i in range(N)]
for ptn in itertools.product('+-', repeat=N):
	tmp = 0
	for (o, a) in zip(ptn, A):
		tmp += int(o + str(a))
	if tmp % 360 == 0:
		print('YES')
		exit()
print('NO')


def raznica(a):
	su = 0
	for i in range(len(a)):
		if a[i] == '0':
			su += x[i]
		if a[i] == '1':
			su -= x[i]
	return su

def tostringerFunc(a):
	a = a[2:]
	if len(a) < nnn:
		a = '0' * (nnn - len(a)) + a
	return a
nnn = int(input())
x = []
for i in range(nnn):
	x.append(int(input()))
binchislo = '0b0'
stringchislo = tostringerFunc(binchislo)
while len(stringchislo) == nnn:
	tmp = abs(raznica(stringchislo))
	if tmp % 360 == 0:
		print('YES')
		exit(0)
	binchislo = bin(int(binchislo, 2) + 1)
	stringchislo = tostringerFunc(binchislo)
print('NO')


n = int(input())
inp = []
RES = []
for i in range(0, n):
	inp.append(int(input()))
RES.append(inp[0])
RES.append(-inp[0])
for i in range(1, n):
	for j in range(0, len(RES)):
		RES[j] += inp[i]
		RES.append(RES[j] - 2 * inp[i])
r = [i % 360 for i in RES]
if 0 in r:
	print('YES')
else:
	print('NO')


n = int(input())
s = [int(input()) for i in range(n)]
for i in range(2 ** n):
	b = bin(i)[2:].zfill(n)
	cs = 0
	for j in range(n):
		if b[j] == '0':
			cs += s[j]
		else:
			cs -= s[j]
	if cs % 360 == 0:
		exit(print('YES'))
print('NO')


def func(arr, i, summ):
	if i == len(arr) and summ % 360 == 0:
		return True
	elif i == len(arr):
		return False
	if func(arr, i + 1, summ + arr[i]):
		return True
	return func(arr, i + 1, summ - arr[i])
n = int(input())
arr = []
for x in range(n):
	arr.append(int(input()))
if func(arr, 0, 0):
	print('YES')
else:
	print('NO')


n = int(input())
lista = []

def solve(pos, degree):
	if pos >= len(lista):
		return degree == 0
	return solve(pos + 1, (degree + lista[pos]) % 360) or solve(pos + 1, (degree - lista[pos]) % 360)
for _ in range(n):
	lista.append(int(input()))
if solve(0, 0):
	print('YES')
else:
	print('NO')


n = int(input())
d = []
summ = 0
fl = False
for i in range(n):
	s = int(input())
	d.append(s)
	summ += s
for i in range(2 ** n):
	st = []
	for ii in range(n):
		st.append(i % 2)
		i //= 2
	w = 0
	for h in range(n):
		if st[h] == 1:
			w += d[h]
		else:
			w -= d[h]
	if w % 360 == 0:
		print('YES')
		fl = True
		break
if not fl:
	print('NO')


def rec(s, n):
	if s % 360 == 0 and n == 0:
		return True
	if n == 0:
		return False
	return rec(s + a[n - 1], n - 1) or rec(s - a[n - 1], n - 1)
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
ans = rec(0, n)
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
L = []

def funkc(i, c):
	if i == n:
		return c % 360
	a = funkc(i + 1, c + L[i])
	b = funkc(i + 1, c - L[i])
	if a == 0 or b == 0:
		return 0
	else:
		return -1
for i in range(n):
	L.append(int(input()))
if funkc(0, 0) == 0:
	print('YES')
else:
	print('NO')


def he(sum, o, n):
	global letter
	if o == n:
		if sum % 360 == 0:
			letter = 'YES'
		return
	he(sum + a[o], o + 1, n)
	he(sum - a[o], o + 1, n)
	return
n = int(input())
a = []
letter = 'NO'
for i in range(n):
	a.append(int(input()))
he(0, 0, n)
print(letter)


import itertools
ugl = []
N = int(input())
for _ in range(N):
	x = int(input())
	ugl.append(x)
sums = sum(ugl)
if sums % 360 == 0:
	print('YES')
else:
	num = sums % 360
	while num <= sums:
		for i in range(1, N):
			for j in itertools.combinations(ugl, i):
				if 2 * sum(j) == num:
					print('YES')
					exit()
		num = num + 360
	print('NO')


n = int(input())
cands = {0}
mod = 360
for i in range(n):
	a = int(input())
	tmp = set()
	for cand in cands:
		tmp.add((cand + a) % mod)
		tmp.add((cand - a) % mod)
	cands = tmp
if 0 in cands:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(input()) for _ in range(n)]
l = {a[0]}
for i in range(1, n):
	t = set()
	for j in l:
		t.add(j + a[i])
		t.add(j - a[i])
	l = t.copy()
ans = 'NO'
for i in l:
	if not i % 360:
		ans = 'YES'
		break
print(ans)


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

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

def li():
	return list(mi())
n = ii()
a = [ii() for i in range(n)]
ans = 0
for i in range(2 ** n):
	s = 0
	for b in range(n):
		if i >> b & 1:
			s += a[b]
		else:
			s -= a[b]
	if s % 360 == 0:
		ans = 1
		break
print('YES' if ans else 'NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))

def solve(state, move, a):
	if move >= len(a):
		return state % 360 == 0
	return solve(state + a[move], move + 1, a) or solve(state - a[move], move + 1, a)
if solve(0, 0, a):
	print('YES')
else:
	print('NO')


n = int(input())
a = [0]
for i in range(n):
	x = int(input())
	new = []
	for j in range(len(a)):
		new.extend([a[j] + x, a[j] - x])
	a = new
for i in range(len(a)):
	if a[i] % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
l = []
flag = False
for i in range(n):
	l.append(int(input()))
s = sum(l)
if s % 360 == 0:
	print('yes')
else:
	for i in range(1, 1 << n):
		curr = 0
		for j in range(n):
			if i & 1 << j:
				curr += l[j]
		if curr == s - curr or abs(s - curr - curr) % 360 == 0:
			flag = True
			break
	if flag:
		print('yes')
	else:
		print('no')


from sys import stdin

def myfunction(n, arr):
	flag = False
	for i in range(1 << n):
		sumi = 0
		for j in range(n):
			if 1 << j & i:
				sumi += arr[j]
			else:
				sumi -= arr[j]
			sumi = sumi % 360
		if sumi == 0:
			flag = True
	if flag:
		return 'YES'
	else:
		return 'NO'
n = int(stdin.readline().strip())
arr = []
for _ in range(n):
	arr.append(int(stdin.readline().strip()))
print(myfunction(n, arr))


rotation_num = int(input())
angles = []
for i in range(0, rotation_num):
	angles.append(int(input()))

def check(array, sum):
	if len(array) == 1:
		if (sum + array[0]) % 360 == 0:
			return 0
		elif (sum - array[0]) % 360 == 0:
			return 0
		else:
			return 1
	f1 = check(array[1:], sum + array[0])
	f2 = check(array[1:], sum - array[0])
	return f1 and f2
if check(angles, 0) == 0:
	print('YES')
else:
	print('NO')


def ver(a, ind, s):
	if ind == len(a) and s % 360 == 0:
		return True
	elif ind == len(a) and s % 360 != 0:
		return False
	else:
		return ver(a, ind + 1, s + a[ind]) or ver(a, ind + 1, s - a[ind])
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
if ver(a, 0, 0):
	print('YES')
else:
	print('NO')


d = []
b = []
n = int(input())
p = 0
for i in range(n):
	n1 = int(input())
	if len(d) == 0:
		d.append(n1)
	elif len(d) == 1:
		e1 = max(d[0], n1) - min(d[0], n1)
		e2 = d[0] + n1
		if i == n - 1:
			if e1 % 360 == 0 or e2 % 360 == 0:
				p = 1
		d.append(e1)
		d.append(e2)
	else:
		t1 = pow(2, i - 1) - 1
		t2 = pow(2, i) - 1
		for j in range(t1, t2):
			e1 = d[j] + n1
			e2 = max(d[j], n1) - min(d[j], n1)
			if i == n - 1:
				if e1 % 360 == 0 or e2 % 360 == 0:
					p = 1
			d.append(e1)
			d.append(e2)
if n == 1:
	if d[0] % 360 == 0:
		print('YES')
	else:
		print('NO')
elif p == 1:
	print('YES')
else:
	print('NO')


cnt = lambda s, x: s.count(x)
ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
dgl = lambda : list(map(int, input()))
il = lambda : list(map(int, input().split()))
n = ii()
x = ii()
l1 = [x, -x]
l2 = []
for i in range(n - 1):
	x = ii()
	if i % 2 == 0:
		l2 = []
		for j in l1:
			l2.extend([j + x, j - x])
	else:
		l1 = []
		for j in l2:
			l1.extend([j + x, j - x])
if n & 1:
	if any((i % 360 == 0 for i in l1)):
		print('YES')
	else:
		print('NO')
elif any((i % 360 == 0 for i in l2)):
	print('YES')
else:
	print('NO')


n = int(input())
degrees = []
for _ in range(n):
	degrees.append(int(input()))
can_reach_last = set([0])
for d in degrees:
	can_reach = set()
	for last in can_reach_last:
		can_reach.add((last + d) % 360)
		can_reach.add((last - d) % 360)
	can_reach_last = can_reach
if 0 in can_reach_last:
	print('YES')
else:
	print('NO')


import itertools
all_angles = []
N = int(input())
for _ in range(N):
	x = int(input())
	all_angles.append(x)
sum_of_all_angles = sum(all_angles)
if sum_of_all_angles % 360 == 0:
	print('YES')
else:
	required = sum_of_all_angles % 360
	while required <= sum_of_all_angles:
		for i in range(1, N):
			for var in itertools.combinations(all_angles, i):
				if 2 * sum(var) == required:
					print('YES')
					exit()
		required = required + 360
	print('NO')


def check(a, i, total, factor):
	total += factor * a[i]
	if total >= 360:
		total -= 360
	elif total <= -360:
		total += 360
	if i == len(a) - 1:
		return total == 0
	else:
		return check(a, i + 1, total, 1) or check(a, i + 1, total, -1)
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
result = check(a, 0, 0, 1) or check(a, 0, 0, -1)
print('YES') if result else print('NO')


n = int(input())
d = [0]
for i in range(n):
	v = int(input())
	x = []
	for j in d:
		x.append(j + v)
		x.append(j - v)
	d = x
flag = 0
for i in d:
	if i % 360 == 0:
		flag = 1
if flag:
	print('YES')
else:
	print('NO')


import sys

def finder(degree: list, summary: int):
	if len(degree) != 0:
		finder(degree[1:], summary + degree[0])
	elif summary % 360 == 0 or summary == 0:
		print('YES')
		sys.exit()
	if len(degree) != 0:
		finder(degree[1:], summary - degree[0])
number_of_turns = int(sys.stdin.readline())
all_degrees = list()
for _ in range(number_of_turns):
	all_degrees.append(int(sys.stdin.readline()))
finder(all_degrees, 0)
print('NO')


n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
flag = False
for i in range(1 << n):
	sm = 0
	for j in range(n):
		if i & 1 << j:
			sm += a[j]
		else:
			sm -= a[j]
	if sm % 360 == 0:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


def findCompleteTurn(t, a):
	mask = 0
	while mask < 1 << t:
		turns_sum = 0
		for i in range(t):
			if mask & 1 << i:
				turns_sum += a[i]
			else:
				turns_sum -= a[i]
		if turns_sum % 360 == 0:
			return 1
		mask += 1
	return 0
t = int(input())
array = [0] * t
for i in range(t):
	array[i] = int(input())
if findCompleteTurn(t, array):
	print('YES')
else:
	print('NO')


cnt = []

def sum_zero(x, i, cnt):
	if x % 360 == 0 and i == n:
		cnt.append(1)
	elif i == n:
		return 0
	else:
		sum_zero(x + l[i], i + 1, cnt)
		sum_zero(x - l[i], i + 1, cnt)
n = int(input())
l = []
for i in range(n):
	a = int(input())
	l.append(a)
sum_zero(0, 0, cnt)
if len(cnt) > 0:
	print('YES')
else:
	print('NO')


def dfs(total_num, curr_num, curr_angle, angles):
	if curr_num == total_num:
		return curr_angle % 360 == 0
	return dfs(total_num, curr_num + 1, curr_angle + angles[curr_num], angles) or dfs(total_num, curr_num + 1, curr_angle - angles[curr_num], angles)

def main():
	total_num = int(input())
	angles = [int(input()) for _ in range(total_num)]
	if dfs(total_num, 0, 0, angles):
		print('YES')
	else:
		print('NO')
main()


n = int(input())
m = []
for i in range(n):
	m.append(int(input()))
mass = []
kod = []
for i in range(2 ** n):
	for j in range(n, -1, -1):
		if i >= 2 ** j:
			i -= 2 ** j
			kod.append(1)
		else:
			kod.append(0)
	mass.append(kod)
	kod = []
otvet = 0
for i in mass:
	for j in range(n):
		if i[j] == 0:
			otvet -= m[j]
		else:
			otvet += m[j]
	if otvet % 360 == 0:
		print('YES')
		exit()
	otvet = 0
print('NO')


n = int(input())
degrees = [0]
for i in range(n):
	val = int(input())
	valArray = []
	for val2 in degrees:
		valArray.append(val2 + val)
		valArray.append(val2 - val)
	degrees = valArray
flag = False
for i in range(len(degrees)):
	if degrees[i] % 360 == 0:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	k = int(input())
	a.append(k)

def f(x):
	s = ''
	b = 2 ** (n - 1)
	while b != 0:
		if x < b:
			s += '0'
		else:
			s += '1'
			x -= b
		b //= 2
	return s
ind = False
for i in range(0, 2 ** n):
	ans = 0
	s = f(i)
	for k in range(len(s)):
		if s[k] == '1':
			ans += a[k]
		else:
			ans -= a[k]
	if ans % 360 == 0:
		ind = True
		break
if ind:
	print('YES')
else:
	print('NO')


n = int(input())
s = [{0}]
M = 360
for _ in range(n):
	s.append(set())
	ai = int(input())
	for x in s[-2]:
		s[-1].add((x + ai) % M)
		s[-1].add((x - ai + M) % M)
print('YES' if 0 in s[-1] else 'NO')


n = int(input())
glob_sum = 0
ang = []
for i in range(n):
	a = int(input())
	ang.append(a)
for a in ang:
	glob_sum = glob_sum + a
up = 2 ** (n - 1)
succ = 0
for i in range(up):
	sum = glob_sum
	specifier = '#0' + str(n + 2) + 'b'
	bin = format(i, specifier)
	bin = bin[2:]
	for j in range(n):
		b = bin[j]
		if b == '1':
			sum = sum - 2 * ang[j]
	if sum == 0:
		succ = 1
		break
	elif abs(sum) % 360 == 0:
		succ = 1
		break
if succ == 1:
	print('YES')
else:
	print('NO')


def check(A, sum, n):
	if n == 0:
		if sum % 360 == 0:
			return True
		else:
			return False
	else:
		return check(A[1:], sum + A[0], n - 1) or check(A[1:], sum - A[0], n - 1)
n = int(input())
A = []
for _ in range(n):
	x = int(input())
	A.append(x)
if check(A, 0, n):
	print('YES')
else:
	print('NO')


from itertools import product
from operator import mul

def dot(a, b):
	return sum(map(mul, a, b))
n = int(input())
a = []
res = False
for _ in range(n):
	a.append(int(input()))
for w in product((-1, 1), repeat=n):
	if dot(a, w) % 360 == 0:
		res = True
		break
if res:
	print('YES')
else:
	print('NO')


import itertools

def works(degs, turn_sequence):
	pos = 0
	for (idx, i) in enumerate(turn_sequence):
		if i:
			pos += degs[idx]
		else:
			pos -= degs[idx]
	if pos % 360 == 0:
		return True
	return False
n_turns = int(input())
degrees = []
for i in range(n_turns):
	degrees.append(int(input()))
if sum(degrees) == 360:
	print('YES')
else:
	maximum = max(degrees)
	idx = degrees.index(maximum)
	degrees.remove(maximum)
	if sum(degrees) == maximum:
		print('YES')
	elif sum(degrees) < maximum:
		print('NO')
	else:
		degrees.insert(idx, maximum)
		ls = list(itertools.product([0, 1], repeat=n_turns))
		for combination in ls:
			if works(degrees, combination):
				print('YES')
				break
		else:
			print('NO')


n = int(input())
l = []

def rec(i, el, sum):
	if i == len(l) - 1:
		sum += el
		if sum % 360 == 0:
			return 1
		return 0
	if rec(i + 1, l[i + 1], sum + el) == 1 or rec(i + 1, -l[i + 1], sum + el) == 1:
		return 1
	return 0
while n > 0:
	n -= 1
	l.append(int(input()))
if rec(0, l[0], 0) == 1 or rec(0, -l[0], 0) == 1:
	print('YES')
else:
	print('NO')


n = int(input())
angles = []
for i in range(n):
	angles.append(int(input()))

def can_sum(n, angles, sum=0):
	if n == 1:
		if (sum + angles[0]) % 360 == 0 or (sum - angles[0]) % 360 == 0:
			return 1
		else:
			return 0
	result1 = can_sum(n - 1, angles[:n - 1], sum + angles[n - 1])
	result2 = can_sum(n - 1, angles[:n - 1], sum - angles[n - 1])
	if result1 == 1 or result2 == 1:
		return 1
	else:
		return 0
if can_sum(n, angles) == 1:
	print('YES')
else:
	print('NO')


def ans(i, a, n, ca):
	if ca >= 360:
		ca -= 360
	if ca <= -360:
		ca += 360
	if i == n:
		if ca == 0:
			return True
		else:
			return False
	else:
		return ans(i + 1, a, n, ca + a[i]) | ans(i + 1, a, n, ca - a[i])
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
if ans(0, a, n, 0):
	print('YES')
else:
	print('NO')


n = int(input())
mass = []
coco = [0]
for u in range(n):
	mass.append(int(input()))
for eq in range(len(mass)):
	for el in range(len(coco)):
		coco[el] += mass[eq]
		coco[el] %= 360
		coco.append(coco[el] - 2 * mass[eq])
if 0 in coco:
	print('YES')
else:
	print('NO')


import itertools
n = int(input())
A = []
D = []
for i in range(n):
	a = int(input())
	A.append(a)
for L in range(0, len(A) + 1):
	for subset in itertools.combinations(A, L):
		a = subset
		d = 0
		for i in a:
			d = d + i
		k = 0
		for i in A:
			k = k + i
		if (k - 2 * d) % 360 == 0:
			D.append('YES')
		else:
			D.append('NO')
if 'YES' in D:
	print('YES')
else:
	print('NO')


import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log10, log2, floor
from itertools import permutations
from heapq import heappush, heappop, heapify
inf = float('inf')
mod = 10 ** 9 + 7

def factorial_p(n, p):
	ans = 1
	if n <= p // 2:
		for i in range(1, n + 1):
			ans = ans * i % p
	else:
		for i in range(1, p - n):
			ans = ans * i % p
		ans = pow(ans, p - 2, p)
		if n % 2 == 0:
			ans = p - ans
	return ans

def nCr_p(n, r, p):
	ans = 1
	while n != 0 or r != 0:
		(a, b) = (n % p, r % p)
		if a < b:
			return 0
		ans = ans * factorial_p(a, p) * pow(factorial_p(b, p), p - 2, p) * pow(factorial_p(a - b, p), p - 2, p) % p
		n //= p
		r //= p
	return ans

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res

def is_prime(n):
	if n < 5 or n & 1 == 0 or n % 3 == 0:
		return 2 <= n <= 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			p = p * p % n
			if p == n - 1:
				break
		else:
			return False
	return True

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	large.reverse()
	small.extend(large)
	return small

def all_subsets(Arr):
	subset = [0] * n
	helper(Arr, subset, 0)

def helper(Arr, subset, i):
	global flag
	if i == n:
		if sum(subset) == 0 or sum(subset) % 360 == 0:
			flag = 1
	else:
		subset[i] = -1 * Arr[i]
		helper(Arr, subset, i + 1)
		subset[i] = Arr[i]
		helper(Arr, subset, i + 1)

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

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

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = []
for i in range(n):
	Arr.append(int(input()))
flag = 0
all_subsets(Arr)
if flag == 1:
	print('YES')
else:
	print('NO')


import itertools
lengths = []
for i in range(int(input())):
	lengths.append(int(input()))
zeroable = False
for i in [x for x in itertools.product('10', repeat=len(lengths))]:
	res = 0
	for k in range(len(lengths)):
		if i[k] == '1':
			res += lengths[k]
		else:
			res -= lengths[k]
	if res % 360 == 0:
		zeroable = True
		break
if zeroable == True:
	print('YES')
else:
	print('NO')


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
except Exception:

	def dprint(*args, **kwargs):
		pass
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
(N,) = getIntList()
za = []
for i in range(N):
	(a,) = getIntList()
	za.append(a)
for mm in range(1 << N):
	c = 0
	for i in range(N):
		if mm & 1 << i:
			c += za[i]
		else:
			c -= za[i]
	if c % 360 == 0:
		print('YES')
		sys.exit()
print('NO')


from itertools import product

def process(*angles: int):
	for signs in product(*((1, -1) for _ in angles)):
		result = 0
		for (sing, value) in zip(signs, angles):
			result += sing * value
		if not result % 360:
			return 'YES'
	return 'NO'

def read_int_row(row):
	return map(int, row.split())

def parse(input_iter):
	return [int(next(input_iter)) for _ in range(int(next(input_iter)))]

def get_std_input():
	while True:
		yield input()

def main():
	print(process(*parse(get_std_input())))
main()


n = int(input())
numbers = [int(input()) for i in range(n)]
POW = 1 << n
flag = 0
for k in range(POW):
	s = 0
	for (i, j) in enumerate(numbers):
		f = 1 << i
		if f & k != 0:
			s += j
		else:
			s -= j
	if s % 360 == 0 or s == 0:
		flag = 1
		break
print(['NO', 'YES'][flag == 1])


n = int(input())
a = []
f = 1
for i in range(n):
	a.append(int(input()))
for i in range(2 ** n):
	b = bin(i)[2:]
	b = '0' * (n - len(b)) + b
	ans = 0
	for j in range(n):
		if b[j] == '1':
			ans = (ans + a[j]) % 360
		else:
			ans = (ans - a[j]) % 360
	if ans == 0:
		f = 0
		print('YES')
		break
if f:
	print('NO')


R = int(input())
AS = [int(input()) for _ in range(R)]
T = [[True] + [False] * 359, [False] * 360]
for a in AS:
	for idx in range(360):
		lidx = (idx + 360 - a) % 360
		ridx = (idx + a) % 360
		if T[0][lidx] or T[0][ridx]:
			T[1][idx] = True
	T = [T[1], [0] * 360]
print('YES' if T[0][0] else 'NO')


def solve(n, n1, s, i):
	if i == n:
		if s % 360 == 0:
			return 1
		return 0
	k1 = solve(n, n1, s + n1[i], i + 1)
	k2 = solve(n, n1, s - n1[i], i + 1)
	return max(k1, k2)

def main():
	n = int(input())
	n1 = [int(input()) for i in range(n)]
	s = 0
	k = solve(n, n1, s, 0)
	if k:
		print('YES')
	else:
		print('NO')
main()


def bins(x, n, nums):
	res = 0
	ln = len(nums) - 1
	for l in range(n):
		if x % 2 == 0:
			res -= nums[ln]
		else:
			res += nums[ln]
		x //= 2
		ln -= 1
	return res
binr = []
x = int(input())
nums = []
for n in range(x):
	nums.append(int(input()))
for n in range(2 ** x):
	binr.append(bins(n, x, nums))
	if bins(n, x, nums) == 0 or bins(n, x, nums) % 360 == 0:
		print('YES')
		exit(0)
print('NO')


N = int(input())
Ans = False
A = int(input())
Angle = [A, -A]
for i in range(N - 1):
	imsi = []
	A = int(input())
	for j in range(len(Angle)):
		imsi.append(Angle[j] + A)
		imsi.append(Angle[j] - A)
	Angle = imsi[:]
for i in Angle:
	if i % 360 == 0:
		print('YES')
		Ans = True
		break
if Ans == False:
	print('NO')


aj = 0

def solve(s1, j):
	global aj
	if j < t - 1:
		solve(s1 + l[j], j + 1)
		solve(s1 - l[j], j + 1)
	elif (s1 + l[j]) % 360 == 0 or (s1 - l[j]) % 360 == 0:
		aj += 1
t = int(input())
l = []
for i in range(t):
	a = int(input())
	l.append(a)
if t < 2:
	if l[0] == 0:
		print('YES')
	else:
		print('NO')
else:
	solve(l[0], 1)
	if aj == 0:
		print('NO')
	else:
		print('YES')


def zamok(lst):
	z = 1 << len(lst)
	for i in range(z):
		current = 0
		for j in range(len(lst)):
			if i >> j & 1:
				current += lst[j]
			else:
				current -= lst[j]
		if current % 360 == 0:
			return 'YES'
	return 'NO'
n = int(input())
b = list()
for x in range(n):
	s = int(input())
	b.append(s)
print(zamok(b))


t = int(input())
arr = []
for _ in range(t):
	arr.append(int(input()))

def solve(arr, n, s):
	if n < 0:
		if s == 0 or s % 360 == 0:
			return True
		return False
	res = solve(arr, n - 1, s - arr[n]) | solve(arr, n - 1, s + arr[n])
	return res
if solve(arr, len(arr) - 1, 0):
	print('YES')
else:
	print('NO')


T = int(input())
rotate = []
flag = 0
summ = 0
msum = 0
for i in range(T):
	rotate.append(int(input()))
rotate.sort()
for i in range(2 ** T):
	summ = 0
	for j in range(T):
		if i & 1 << j > 0:
			summ = summ + rotate[j]
		else:
			summ = summ - rotate[j]
	if summ % 360 == 0:
		flag = 1
if flag == 1:
	print('YES')
else:
	print('NO')


n = int(input())
L = []
for _ in range(n):
	L.append(int(input()))

def pset(n):
	L = []
	for i in range(2 ** n):
		temp = []
		while i != 0:
			temp.append(i % 2)
			i = i // 2
		L.append(temp)
	return L
X = pset(n)
s = sum(L)
for i in X:
	temp = 0
	for j in range(0, len(i)):
		if i[j] == 1:
			temp += L[j]
	if temp % 360 == (s - temp) % 360:
		print('YES')
		break
else:
	print('NO')


import sys

def solve():
	rotations = []
	for line in sys.stdin:
		rotations.append(int(line.rstrip()))
	n = rotations.pop(0)
	for i in range(1 << n - 1):
		mask = 1
		total = 0
		for j in range(n):
			total += (-1 if i & mask == 0 else 1) * rotations[j]
			mask <<= 1
		if total % 360 == 0:
			print('YES')
			return
	print('NO')
solve()


n = int(input())
ang = [0] * 360
a = int(input())
ang[a] = ang[360 - a] = 1
for i in range(1, n):
	ang2 = [0] * 360
	a = int(input())
	for j in range(360):
		if ang[j] == i:
			ang2[(j + a) % 360] = ang2[(j + 360 - a) % 360] = i + 1
	ang = ang2
print('YES' if ang[0] == n else 'NO')


def sol(n, a):
	power = 2 ** n
	sumv = 0
	for i in range(power):
		bina = bin(i)
		bina = bina[2:]
		bv = '0' * (n - len(bina)) + bina
		j = 0
		sumv = 0
		for b in bv:
			if b == '1':
				sumv += a[j]
			else:
				sumv -= a[j]
			j += 1
		if sumv == 0 or sumv == 360 or sumv % 360 == 0:
			return 'YES'
	return 'NO'
n = int(input())
l = [int(input()) for i in range(n)]
v = sol(n, l)
print(v)


def next_turn(k, n, summ, turns):
	if k == n:
		return summ % 360 == 0
	return next_turn(k + 1, n, summ + turns[k], turns) or next_turn(k + 1, n, summ - turns[k], turns)
n = int(input())
turns = [int(input()) for _ in range(n)]
print(['NO', 'YES'][next_turn(0, n, 0, turns)])


from itertools import product as cwr
n = int(input())
nums = [int(input()) for _ in range(n)]
print('YES' if any([sum([(-1) ** p * nums[i] for (i, p) in enumerate(mode)]) % 360 == 0 for mode in cwr([0, 1], repeat=n)]) else 'NO')


c = 0

def backtracking(actuales, restantes, n):
	global c
	if (sum(actuales) % 360 == 0 or sum(actuales) == 0) and len(actuales) == n:
		c = 1
	if restantes:
		backtracking(actuales + [restantes[0]], restantes[1:], n)
		backtracking(actuales + [-restantes[0]], restantes[1:], n)
	return 0

def main():
	n = int(input())
	degrees = []
	for i in range(n):
		degrees.append(int(input()))
	backtracking([], degrees, n)
	global c
	if c == 1:
		return 'YES'
	else:
		return 'NO'
	return c
print(main())


R = int(input())
ar = []
for r in range(R):
	ar.append(int(input()))
isTrue = False
for i in range(2 ** R):
	bi = bin(i)[2:]
	bi = '0' * (R - len(bi)) + bi
	bi = bi[::-1]
	tS = 0
	for j in range(len(bi)):
		if bi[j] == '1':
			tS += ar[j]
		else:
			tS -= ar[j]
	if tS % 360 == 0:
		isTrue = True
		break
if isTrue:
	print('YES')
else:
	print('NO')


from itertools import product
n = int(input())
all_subsets = [*product(range(-1, 2, 2), repeat=n)]
l = []

def solve(l):
	if sum(l) % 360 == 0:
		print('YES')
		exit()

def fun(l):
	(a, b) = l
	return a * b
for i in range(n):
	x = int(input())
	l.append(x)
[solve(list(map(fun, zip(l, subsets)))) for subsets in all_subsets]
print('NO')


def has_sol(n):
	l = [(-n[0], 1), (n[0], 1)]
	while len(l):
		p = l.pop(0)
		if p[1] < len(n):
			l.append(tuple((p[0] - n[p[1]], p[1] + 1)))
			l.append(tuple((p[0] + n[p[1]], p[1] + 1)))
		if p[0] % 360 == 0 and p[1] == len(n):
			print('YES')
			break
	else:
		print('NO')
n = int(input())
l = []
for x in range(n):
	l.append(int(input()))
has_sol(l)


from sys import stdin

def recSolve(vec, sum, ptr):
	if ptr == len(vec):
		if sum % 360 == 0:
			return True
		else:
			return False
	if not recSolve(vec, sum + vec[ptr], ptr + 1):
		return recSolve(vec, sum - vec[ptr], ptr + 1)
	else:
		return True
n = int(stdin.readline())
vec = [int(stdin.readline()) for _ in range(n)]
if recSolve(vec, 0, 0):
	print('YES')
else:
	print('NO')


n = int(input())
a = []
b = []
for _ in range(n):
	s = int(input())
	a.append(s)
for i in range(pow(2, n)):
	s = bin(i)
	s = s[2:]
	s = s.zfill(n)
	b.append(s)
su = 0
for i in b:
	su = 0
	for j in range(len(i)):
		if i[j] == '1':
			su -= a[j]
		else:
			su += a[j]
	if su % 360 == 0:
		print('YES')
		n = -99
		break
if n != -99:
	print('NO')


def solve(n):
	ans = [0, 0]
	for _ in range(n):
		temp = []
		rot = int(input())
		for x in ans:
			temp.append(x + rot)
		for x in ans:
			temp.append(x - rot)
		ans = temp[:]
	for elem in ans:
		if elem % 360 == 0:
			return 'YES'
	return 'NO'

def main():
	n = int(input())
	print(solve(n))
main()


n = int(input())
a = []
for _ in range(n):
	a += [int(input())]
for i in range(2 ** n):
	c = 0
	for j in range(n):
		if i >> j & 1 == 1:
			c = (c + a[j]) % 360
		else:
			c = (360 + c - a[j]) % 360
	if c == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
A = []
for i in range(n):
	A.append(int(input()))
for i in range(1 << n):
	cnt = 0
	s = 0
	for j in bin(i)[2:].zfill(n):
		if j == '0':
			s = (s + A[cnt]) % 360
		else:
			s = (s - A[cnt]) % 360
		cnt += 1
	if s == 0:
		print('yes')
		break
else:
	print('no')


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

def li():
	return [int(i) for i 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')]

def recursive(a, i=0, tot=0):
	if len(a) == i and (not tot % 360):
		print('YES')
		exit()
	elif i == len(a):
		return
	recursive(a, i + 1, tot + a[i])
	recursive(a, i + 1, tot - a[i])
n = val()
a = []
for i in range(n):
	a.append(val())
recursive(a)
recursive(a)
print('NO')


N = int(input())
l = []
for i in range(N):
	l.append(int(input()))
flag = False
for i in range(2 ** N):
	ans = 0
	for j in range(N):
		if i & 1 == 0:
			ans += l[j]
		else:
			ans -= l[j]
		i >>= 1
	if ans % 360 == 0:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


from itertools import combinations as C
from itertools import permutations as P
n = int(input())
a = [int(input()) for i in range(n)]

def check():
	global a, n
	for c in range(n // 2 + 1):
		for pos in C(range(n), c):
			ks = [1] * n
			for i in pos:
				ks[i] = -1
			s = sum([a[i] * ks[i] for i in range(n)])
			if s % 360 == 0:
				return 'YES'
				exit()
	return 'NO'
print(check())


def check(r, n):
	for i in range(2 ** n):
		mask = 1
		result = 0
		for j in range(n):
			if i & mask * 2 ** j:
				result -= r[j]
			else:
				result += r[j]
		if result % 360 == 0:
			return True
	return False
n = int(input())
rot = []
for i in range(n):
	rot.append(int(input()))
if check(rot, n):
	print('YES')
else:
	print('NO')


from math import ceil
from math import floor

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def find_least_diff(n):
	A = 2 * (pow(2, n / 2 - 1) - 1)
	B = -pow(2, n / 2)
	return int(abs(B - A))

def find_ways(n):
	return (n - 1) // 2

def count_digits(n):
	m = 9
	count = n
	while True:
		if n >= m:
			count += n - m
		else:
			break
		m = str(m)
		m += '9'
		m = int(m)
	return count

def kth_bit_set(n, k):
	return n & 1 << k - 1

def sum_is_zero(n, arr):
	for i in range(pow(2, n)):
		angle_sum = 0
		for j in range(n):
			if kth_bit_set(i, j + 1):
				angle_sum += arr[j]
			else:
				angle_sum -= arr[j]
		if angle_sum % 360 == 0:
			return True
	return False

def get_board(n, m, mat):
	for i in range(n):
		for j in range(m):
			print(i, j)
			if mat[i][j] == '.':
				if (j > 0 and mat[i][j - 1] != 'B') and (i > 0 and mat[i - 1][j] != 'B'):
					mat[i][j] = 'B'
				else:
					mat[i][j] = 'W'
	for i in range(n):
		for j in range(m):
			print(mat[i][j])
t = 1
while t:
	t = t - 1
	count = 0
	px = []
	py = []
	n = int(input())
	arr = []
	for i in range(n):
		angle = int(input())
		arr.append(angle)
	if sum_is_zero(n, arr):
		print('YES')
	else:
		print('NO')


n = int(input())
a = [0]
for _ in range(n):
	b = int(input())
	c = []
	for i in a:
		c.append(i + b)
		c.append(i - b)
	a = c
tag = False
for i in a:
	if i % 360 == 0:
		tag = True
		break
if tag:
	print('YES')
else:
	print('NO')


n = int(input())
angles = [int(input()) for _ in range(n)]
pos = sum(angles) // 2

def check(i, sm=0):
	if i >= n:
		return False
	elif i == n - 1 and ((sm + angles[i]) % 360 == 0 or (sm - angles[i]) % 360 == 0):
		return True
	elif check(i + 1, sm + angles[i]):
		return True
	elif check(i + 1, sm - angles[i]):
		return True
	else:
		return False
if check(1, sm=angles[0]) or check(1, -1 * angles[0]):
	print('YES')
else:
	print('NO')


import sys, itertools, math

def ia():
	return [int(i) for i in sys.stdin.readline().strip().split(' ')]

def ii():
	return int(sys.stdin.readline().strip())

def istr():
	return sys.stdin.readline().strip()
N = []
for _ in range(ii()):
	N.append(ii())
V = set([0])
while N:
	n = N.pop()
	NV = set()
	for v in V:
		n1 = (n + v) % 360
		n2 = (n - v) % 360
		NV.add(n1)
		NV.add(n2)
	V = NV
if 0 in V:
	print('YES')
else:
	print('NO')


(n, l) = (int(input()), [])
for i in range(n):
	l.append(int(input()))

def check(s, b):
	if b == 0:
		if s == 0 or s % 360 == 0:
			return True
		return False
	if b < 0:
		return
	return check(s - l[b - 1], b - 1) or check(s + l[b - 1], b - 1)
if check(0, n):
	print('YES')
else:
	print('NO')


def set_sign(signs, k, val):
	new_signs = signs.copy()
	new_signs.append(val)
	return new_signs

def backtrack(arr, signs, k=0):
	if k == len(arr):
		return sum((sign * a for (sign, a) in zip(signs, arr))) % 360 == 0
	return backtrack(arr, set_sign(signs, k, 1), k + 1) or backtrack(arr, set_sign(signs, k, -1), k + 1)

def solve():
	n = int(input())
	arr = [int(input()) for _ in range(n)]
	if backtrack(arr, []):
		print('YES')
	else:
		print('NO')
solve()


n = int(input())
s = set([0])
total = 0
for _ in range(n):
	x = int(input())
	total += x
	s = s | set((x + val for val in s))
for x in s:
	if abs(total - 2 * x) % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = [int(input()) for _ in range(n)]
ok = False
for i in range(2 ** n):
	bi = bin(i)[2:]
	bi = '0' * (n - len(bi)) + bi
	if sum(((-1 if bi[j] == '0' else 1) * a[j] for j in range(n))) % 360 == 0:
		ok = True
print('YES' if ok else 'NO')


import sys

def check(arr, s, ind):
	if s % 360 == 0 and ind == 15:
		print('YES')
		exit(0)
	if ind >= 15:
		return
	check(arr, s + arr[ind], ind + 1)
	check(arr, s - arr[ind], ind + 1)
n = int(sys.stdin.readline())
ip = []
for i in range(n):
	a = int(sys.stdin.readline())
	ip.append(a)
for i in range(n, 15):
	ip.append(0)
check(ip, 0, 0)
print('NO')


from itertools import combinations as co
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
for i in range(1 << n):
	s = 0
	for j in range(n):
		if i & 1 << j:
			s += a[j]
		else:
			s -= a[j]
	if s % 360 == 0:
		print('yes')
		break
else:
	print('no')


n = int(input())
l = [int(input()) for _ in range(n)]
i = 0
n2 = 1 << n
res = False
while i < n2:
	b = bin(i)[2:].zfill(n)
	s = 0
	for (j, e) in enumerate(b):
		if e == '0':
			s += l[j]
		else:
			s -= l[j]
	if s % 360 == 0:
		res = True
	i += 1
if res:
	print('YES')
else:
	print('NO')


from itertools import *
import sys
(n, *a) = map(int, sys.stdin.read().split())
S = sum(a)
for z in chain.from_iterable((combinations(a, r) for r in range(n))):
	if (S - 2 * sum(z)) % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
a = []
for i in range(n):
	k = int(input())
	a.append(k)
for i in range(2 ** n):
	sp = 0
	sn = 0
	for j in range(n):
		if 1 << j & i == 0:
			sp += a[j]
		else:
			sn += a[j]
	sp %= 360
	sn %= 360
	if sn == sp:
		print('YES')
		exit()
print('NO')


from sys import stdin, stdout

def read():
	return stdin.readline().rstrip()

def readint():
	return int(read())
xs = []
n = readint()
for _ in range(n):
	xs.append(readint())
for i in range(1 << len(xs)):
	r = []
	for x in range(len(xs)):
		if i & 1 << x:
			r.append(xs[x])
		else:
			r.append(-xs[x])
	if sum(r) % 360 == 0:
		print('YES')
		break
else:
	print('NO')


def new(n, mask):
	for i in range(n - 1, -1, -1):
		if mask[i] == 1:
			mask[i] = 0
		else:
			mask[i] = 1
			return mask

def main():
	n = int(input())
	rotates = []
	for i in range(n):
		rotates.append(int(input()))
	mask = [0 for i in range(n)]
	for i in range(2 ** n):
		cur = 0
		for j in range(n):
			if mask[j]:
				cur += rotates[j]
			else:
				cur -= rotates[j]
			cur %= 360
		if cur == 0:
			print('YES')
			return 0
		mask = new(n, mask)
	print('NO')
	return 0
main()


n = int(input())
l = []
comb = []
tot = 0
import itertools
for x in range(n):
	temp = int(input())
	l.append(temp)
	tot += temp
for i in range(0, n + 1):
	comb.extend(itertools.combinations(l, i))
for x in comb:
	temp = sum(x)
	if abs(temp - (tot - temp)) % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
l = [0]
for i in range(n):
	x = int(input())
	temp = []
	for j in range(len(l)):
		temp.append(x + l[j])
		temp.append(x - l[j])
	l = temp
for i in range(len(l)):
	if l[i] % 360 == 0:
		print('YES')
		exit()
print('NO')


from itertools import combinations as co
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
s = sum(a)
for i in range(1, n + 1):
	x = list((1 for y in co(a, i) if (s - 2 * sum(y)) % 360 == 0))
	if len(x) != 0:
		print('yes')
		break
else:
	print('no')


from sys import stdin
n = int(stdin.readline())
xs = []
for _ in range(n):
	x = int(stdin.readline())
	xs.append(x)
possible = False
MAX = 1 << n
for combination in range(1, MAX):
	curr = 0
	x = combination
	for i in range(n):
		direction = x % 2
		if direction == 0:
			curr = (curr + xs[i]) % 360
		else:
			curr = (curr - xs[i]) % 360
		x = x // 2
	if curr == 0:
		possible = True
		break
print('YES' if possible else 'NO')


n = int(input())
s = {0}
for _ in range(n):
	s1 = int(input())
	s2 = set()
	for i in s:
		s2.add((i + s1) % 360)
		s2.add((i - s1) % 360)
	s = s2
if 0 in s2:
	print('YES')
else:
	print('NO')


from itertools import product as prd
n = int(input())
l = [int(input()) for i in range(n)]
s = '{}'.join(map(str, l))
p = prd('+-', repeat=n)
if not sum(l) % 360:
	print('YES')
elif len(set(l)) == 1:
	if not n % 2:
		print('YES')
	else:
		print('NO')
elif sum(l) >= 360:
	for i in p:
		if not eval(s.format(*i)) or not eval(s.format(*i)) % 360:
			print('YES')
			break
	else:
		print('NO')
else:
	for i in p:
		if not eval(s.format(*i)):
			print('YES')
			break
	else:
		print('NO')


from collections import Counter
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')
import math
x = int(input())
ls = []
for j in range(x):
	a = int(input())
	ls.append(a)
for i in range(0, 2 ** x):
	s = 0
	for j in range(x):
		if i & 1 << j:
			s += ls[j]
		else:
			s -= ls[j]
	if s % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
dp = [[float('-inf') for j in range(360)] for i in range(n + 1)]
dp[0][0] = 0
for i in range(n):
	a = int(input())
	for j in range(360):
		dp[i + 1][j] = max(dp[i][(j - a) % 360], dp[i][(j + a) % 360])
print('YES' if dp[-1][0] == 0 else 'NO')


n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
x = sum(arr)
for i in range(2 ** n):
	s = 0
	for j in range(n):
		if i & 1 << j:
			s += arr[j]
	if (x - 2 * s) % 360 == 0 or x % 360 == 0:
		print('YES')
		break
else:
	print('NO')


def fun(ss, arr, i):
	if i > len(arr) - 1:
		if ss % 360 == 0:
			print('YES')
			exit()
		return
	else:
		fun(ss - arr[i], arr, i + 1)
		fun(ss + arr[i], arr, i + 1)
n = int(input())
arr = []
for i in range(n):
	x = int(input())
	arr.append(x)
ss = 0
fun(ss, arr, 0)
print('NO')


n = int(input())
mas = [int(input()) for i in range(n)]
(res, lst) = ([mas[0], -mas[0]], [])
for i in range(1, n):
	a = mas[i]
	for (j, x) in enumerate(res):
		lst.append(x + a)
		lst.append(x - a)
	res = list(lst)
	lst = []
for (i, x) in enumerate(res):
	if x % 360 == 0:
		print('YES')
		from sys import exit
		exit()
print('NO')


n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
ans = False
for y in range(2 ** n):
	x = list(bin(y))
	x.reverse()
	x.pop()
	x.pop()
	while len(x) < n:
		x.append('0')
	s = 0
	for i in range(n):
		if x[i] == '1':
			s += a[i]
		elif x[i] == '0':
			s -= a[i]
	if s % 360 == 0:
		ans = True
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
rotations = []
for i in range(n):
	rotations.append(int(input()))
memo = [[-1] * 361 for i in range(n)]

def solve(i, curr):
	if i == n:
		return True if curr == 0 else False
	if curr < 0:
		curr = 360 + curr
	if curr >= 360:
		curr -= 360
	if memo[i][curr] == -1:
		memo[i][curr] = solve(i + 1, curr - rotations[i]) or solve(i + 1, curr + rotations[i])
	return memo[i][curr]
if solve(0, 0):
	print('YES')
else:
	print('NO')


def find(a):
	for i in range(1, 1 << len(a)):
		x = 0
		for j in range(0, len(a)):
			if i & 1 << j:
				x = x + a[j]
			else:
				x = x - a[j]
		if x % 360 == 0:
			return 'YES'
	return 'NO'
m = int(input())
a = []
for i in range(m):
	a.append(int(input()))
print(find(a))


def fu(s, w, n):
	if n == len(w):
		ans.append(w)
		return
	for i in range(len(s)):
		w = w[:n] + s[i] + w[n + 1:]
		fu(s, w, n + 1)
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
ans = []
s = 'l' * n
fu('01', s, 0)
for i in ans:
	co = 0
	for j in range(len(i)):
		if i[j] == '1':
			co += a[j]
		else:
			co -= a[j]
	if co % 360 == 0:
		print('YES')
		exit()
print('NO')


TN = 1

def solution():
	n = int(input())
	a = []
	for i in range(n):
		a.append(int(input()))
	for i in range(1 << n):
		cpI = i
		ans = 0
		for j in range(n):
			if cpI % 2 == 1:
				ans += a[j]
			else:
				ans -= a[j]
			cpI //= 2
		if ans % 360 == 0:
			print('YES')
			break
	else:
		print('NO')
while TN != 0:
	solution()
	TN -= 1


n = int(input())
numbers = [0 for x in range(n)]
for i in range(n):
	numbers[i] = int(input())
found = False
for i in range(2 ** (n - 1)):
	binary = bin(i)
	m = len(binary)
	sum = numbers[n - 1]
	for j in range(n - 1):
		if j > m - 3:
			sum -= numbers[j]
		elif binary[m - j - 1] == '0':
			sum -= numbers[j]
		else:
			sum += numbers[j]
	if sum % 360 == 0:
		found = True
if found:
	print('YES')
else:
	print('NO')


import itertools
import sys
amount = int(input())
array = []
for i in range(amount):
	array.append(int(input()))
for i in range(2 ** amount):
	string = bin(i)
	perm = string[2:]
	perm += '0' * (amount - len(perm))
	res = []
	for i in range(amount):
		res.append((-1) ** (int(perm[i]) + 1) * array[i])
	if abs(sum(res)) % 360 == 0:
		print('YES')
		sys.exit(0)
print('NO')


n = int(input())
a = [int(input()) for i in range(n)]
b = [0]
for i in a:
	c = []
	for j in b:
		c.append((i + j) % 360)
		c.append((360 - i + j) % 360)
	b = list(set(c))
print('YES' if 0 in b else 'NO')


n = int(input())
positions = [0]
for _ in range(n):
	new_positions = []
	action = int(input())
	for pos in positions:
		new_positions.append(pos - action)
		new_positions.append(pos + action)
	positions = new_positions
for result in positions:
	if result % 360 == 0:
		print('YES')
		break
else:
	print('NO')


def explore(arr, curr, i):
	if i == len(arr):
		if curr == 0 or curr % 360 == 0:
			return True
		return False
	return explore(arr, curr - arr[i], i + 1) or explore(arr, curr + arr[i], i + 1)

def CF1097B():
	N = int(input())
	arr = [int(input()) for _ in range(N)]
	return explore(arr, -arr[0], 1) or explore(arr, arr[0], 1)
res = CF1097B()
print('YES' if res else 'NO')


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
a = sorted(a)
s = [0]
k = 1
for i in a:
	s1 = []
	for j in range(k):
		s1.append(s[j] + i)
		s1.append(s[j] - i)
	k *= 2
	s = s1
s = [i % 360 for i in s]
if 0 in s:
	print('YES')
else:
	print('NO')


n = int(input())
s = []
a = int(input())
s.append(360 - a)
s.append(a)
ss = []
for i in range(n - 1):
	a = int(input())
	for j in range(len(s)):
		if s[j] - a <= 0:
			k = 360 + s[j] - a
		else:
			k = s[j] - a
		if s[j] + a >= 360:
			b = s[j] + a - 360
		else:
			b = s[j] + a
		ss.append(b)
		ss.append(k)
	s = ss
	ss = []
if 0 in s or 360 in s:
	print('YES')
else:
	print('NO')


import sys
lines = sys.stdin.readlines()
numrots = int(lines[0].strip())
rots = list(map(int, lines[1:]))
assert len(rots) == numrots
possible = False
for i in range(2 ** numrots):
	total = 0
	for rot in rots:
		sign = i % 2
		i >>= 1
		if sign:
			total += rot
		else:
			total -= rot
	if total % 360 == 0:
		possible = True
if possible:
	print('YES')
else:
	print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
res = []
flag = True

def solve(t):
	global flag
	if flag:
		if t == n:
			p = 0
			for i in range(n):
				p += l[i] * res[i]
			if abs(p) % 360 == 0 or p == 0:
				print('YES')
				flag = False
		else:
			for i in [-1, 1]:
				res.append(i)
				solve(t + 1)
				res.pop()
solve(0)
if flag:
	print('NO')


n = int(input(''))
a = [-1] * 20
for i in range(0, n):
	a[i] = int(input(''))
answer = 'NO'
for i in range(0, 1 << n):
	s = 0
	for j in range(0, n):
		if i & 1 << j:
			s += a[j]
		else:
			s -= a[j]
	if s % 360 == 0:
		answer = 'YES'
		break
print(answer)


N = int(input())
n = [int(input()) for i in range(N)]
s = sum(n)
w = 0
for k in range(2 ** N):
	p = sum((n[i] for i in range(N) if k & 1 << i))
	if (s - p - p) % 360 == 0:
		print('YES')
		w = 1
		break
if w == 0:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))

def check_sum(i, sum):
	if i > n - 1:
		return sum
	l = check_sum(i + 1, sum - a[i])
	r = check_sum(i + 1, sum + a[i])
	if l % 360 == 0 or r % 360 == 0:
		return 0
	else:
		return 1
if check_sum(0, 0) == 0:
	print('YES')
else:
	print('NO')


def IsPossible(a):
	n = len(a)
	for i in range(0, 1 << n):
		s = 0
		for j in range(0, n):
			if i & 1 << j:
				s += a[j]
			else:
				s -= a[j]
		if s == 0 or s % 360 == 0:
			print('YES')
			exit()
	print('NO')
	exit()
n = int(input())
a = []
for i in range(0, n):
	val = int(input())
	a.append(val)
IsPossible(a)


def xq(count, sum, x):
	if count == 0:
		if sum % 360 == 0:
			return 1
		else:
			return 0
	if xq(count - 1, sum + x[count - 1], x):
		return 1
	elif xq(count - 1, sum - x[count - 1], x):
		return 1
	else:
		return 0
n = int(input())
x = []
for i in range(n):
	x.append(int(input()))
if xq(n, 0, x):
	print('YES')
else:
	print('NO')


res = [0]
t = []
for _ in range(int(input())):
	n = int(input())
	t.clear()
	for i in res:
		t.append(i + n)
		t.append(i - n)
	res.clear()
	res = t.copy()
for _ in res:
	if _ % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
l = []
ans = 0
for i in range(n):
	l.append(int(input()))

def rec(a, l):
	global ans
	if len(l) == 0:
		if a % 360 == 0:
			ans = 1
			return 1
		else:
			return 0
	else:
		return rec(a - l[0], l[1:]) + rec(a + l[0], l[1:])
rec(2880, l)
if ans == 1:
	print('YES')
else:
	print('NO')


def gt(x, s, l, n):
	if x == n:
		if s % 360 == 0 or s == 0:
			return True
		else:
			return False
	return gt(x + 1, s + l[x], l, n) | gt(x + 1, s - l[x], l, n)
n = int(input())
x = 0
l = [int(input()) for _ in range(n)]
s = 0
if gt(x, s, l, n):
	print('YES')
else:
	print('NO')


n = int(input())
l = int(input()) % 360
l = [l, -l]
for j in range(n - 1):
	k = int(input()) % 360
	r = []
	for i in l:
		r.append((i + k) % 360)
		r.append((i - k) % 360)
	l = r[:]
if 0 in l:
	print('YES')
elif 360 in l:
	print('YES')
else:
	print('NO')


n = int(input())
pre = set()
pre.add(0)
for _ in range(n):
	x = int(input())
	p = set()
	for y in pre:
		p.add((x + y) % 360)
		p.add(abs(x - y))
	pre = p
if 0 in pre:
	print('YES')
else:
	print('NO')


def rotate(i, gr, allgr):
	global n
	if i >= n - 1:
		allgr += gr
		if allgr % 360 == 0:
			return '1'
		else:
			return '0'
	else:
		return str(rotate(i + 1, -1 * a[i + 1], allgr + gr)) + str(rotate(i + 1, a[i + 1], allgr + gr))
n = int(input())
a = []
for i in range(n):
	x = int(input())
	a.append(x)
ot = rotate(0, a[0], 0) + rotate(0, -1 * a[0], 0)
if '1' in ot:
	print('YES')
else:
	print('NO')


n = int(input())
l = []
for k in range(n):
	l += [int(input())]

def rot(arr):
	if len(arr) == 1:
		return 'NO'
	final_step = arr.pop()
	s = {arr.pop(0)}
	new_s = set()
	for step in arr:
		for x in s:
			new_s.add(x - step)
			new_s.add(x + step)
		s = new_s
		new_s = set()
	for y in s:
		if (y - final_step) % 360 == 0 or (y + final_step) % 360 == 0:
			return 'YES'
	return 'NO'
print(rot(l))


import sys
n = int(input())
a = list()
for i in range(n):
	a.append(int(input()))
flag = False
for i in range(1 << n):
	x = i
	j = 0
	s = 0
	while j < n:
		if x & 1:
			s += a[j]
		else:
			s -= a[j]
		j += 1
		x >>= 1
	if s % 360 == 0:
		flag = True
		break
if not flag:
	sys.stdout.write('NO\n')
else:
	sys.stdout.write('YES\n')


def pov(n, gr, gl):
	if n != 0:
		return str(pov(n - 1, gr - gl[n - 1], gl) + pov(n - 1, gr + gl[n - 1], gl))
	elif gr % 360 == 0:
		return 'YES'
	else:
		return 'NO'
a = int(input())
gl = []
for i in range(a):
	gl.append(int(input()))
st = pov(a, 0, gl)
if 'Y' in st:
	print('YES')
else:
	print('NO')


n = int(input())
Arr = []
flag = 0
for i in range(n):
	Arr.append(int(input()))
for i in range(1 << n):
	B = []
	for j in range(n):
		if i >> j & 1:
			B.append(Arr[j])
		else:
			B.append(-1 * Arr[j])
	if sum(B) % 360 == 0:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a += [int(input())]
f = 0
for i in range(1 << n):
	t = 0
	for j in range(n):
		if i & 1 << j:
			t += a[j]
		else:
			t -= a[j]
	if t % 360 == 0:
		f = 1
		break
if f == 1:
	print('yes')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))

def make_exp(a, symbols):
	ans = 0
	for i in range(len(a)):
		if symbols[i] == '0':
			ans -= a[i]
		else:
			ans += a[i]
	return ans
found = False
for i in range(2 ** n):
	symbols = str(bin(i))[2:]
	symbols = '0' * (n - len(symbols)) + symbols
	if make_exp(a, symbols) % 360 == 0:
		found = True
		break
if found:
	print('YES')
else:
	print('NO')


Values = []
answer = False
FutureValues = []
Values.append(0)
Angles = []
n = int(input())
for i in range(n):
	Angles.append(int(input()))
for i in range(n):
	for j in range(len(Values)):
		a = Values[j] + Angles[i]
		b = Values[j] - Angles[i]
		if a < 0:
			a = 360 + a
		elif a >= 360:
			a -= 360
		if b < 0:
			b = 360 + b
		elif b >= 360:
			b -= 360
		if a == 0 or b == 0:
			if i == n - 1:
				answer = True
				print('YES')
				break
		if a not in FutureValues:
			FutureValues.append(a)
		if b not in FutureValues:
			FutureValues.append(b)
	Values = FutureValues
	FutureValues = []
	if answer:
		break
if answer is False:
	print('NO')


def main():
	prob_len = int(input())
	dials = list()
	possibles = set()
	for _ in range(prob_len):
		dials.append(int(input()))
	for dial in dials:
		new_possibles = set()
		if not possibles:
			new_possibles.add(dial % 360)
			new_possibles.add(-dial % 360)
		for possible in possibles:
			new_possibles.add((possible + dial) % 360)
			new_possibles.add((possible - dial) % 360)
		possibles = new_possibles
	if 0 in possibles:
		print('YES')
	else:
		print('NO')
main()


def subsum(arr, l, r, sums=0):
	global done
	if l > r:
		if sums % 360 == 0:
			done = True
		return True
	if not done:
		subsum(arr, l + 1, r, sums + arr[l])
		subsum(arr, l + 1, r, sums - arr[l])
done = False
l = []
n = int(input())
for _ in range(n):
	l.append(int(input()))
subsum(l, 0, n - 1)
if done:
	print('YES')
else:
	print('NO')


n = int(input())
flag = 0
if n == 1:
	print('NO')
else:
	l = []
	sum1 = 0
	for _ in range(0, n):
		p = int(input())
		sum1 = sum1 + p
		l.append(p)
	if sum1 % 360 == 0:
		print('YES')
	else:
		l1 = []
		l1.append(l[0])
		p = 1
		i1 = 0
		for i in range(1, n):
			i1 = 0
			while i1 < p:
				c = l1.pop(0)
				l1.append(c + l[i])
				l1.append(c - l[i])
				i1 += 1
			p = p * 2
		for p in l1:
			if p % 360 == 0:
				flag = 1
				break
		if flag == 1:
			print('YES')
		else:
			print('NO')


num1 = int(input())
a = 0
f = [0]
k = []
for i in range(num1):
	num2 = int(input())
	z = []
	for n in f:
		z.append(n - num2)
		z.append(n + num2)
	f = z
for y in z:
	if y % 360 == 0:
		k.append(1)
if len(k) > 0:
	print('YES')
else:
	print('NO')


n = int(input())
c = []
for i in range(n):
	c.append(int(input()))
for i in range(2 ** n):
	a = bin(i)
	a = a[2:]
	a = a.zfill(n)
	s = 0
	for j in range(len(c)):
		if a[j] == '0':
			s -= c[j]
		else:
			s += c[j]
	if s % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
ls = [int(input()) for _ in range(n)]

def IsTherePossibleSumToGet0(ls, n):
	for mask in range(0, 1 << n):
		Sum = 0
		for i in range(n):
			if mask >> i & 1:
				Sum += ls[i]
			else:
				Sum -= ls[i]
		if Sum == 0 or Sum % 360 == 0:
			print('YES')
			return
	print('NO')
IsTherePossibleSumToGet0(ls, n)


def permutations(seq, num):
	if num == len(seq) - 1:
		print(seq)
		return
	for i in range(num, len(seq)):
		(seq[num], seq[i]) = (seq[i], seq[num])
		permutations(seq, num + 1)
		seq[num] = -seq[num]
		permutations(seq, num + 1)
		seq[num] = -seq[num]
		(seq[num], seq[i]) = (seq[i], seq[num])

def permutations2(seq, num):
	if num == len(seq):
		sum = 0
		for x in seq:
			sum += x
		if sum % 360 == 0:
			return True
		else:
			return False
	if permutations2(seq, num + 1):
		return True
	seq[num] = -seq[num]
	if permutations2(seq, num + 1):
		return True
	seq[num] = -seq[num]
	return False
num = int(input())
turns = []
for i in range(num):
	turns.append(int(input()))
print('YES' if permutations2(turns, 0) else 'NO')


import copy
num = int(input())
list_1 = {0}
for i in range(num):
	n = int(input())
	list_2 = set()
	for j in list_1:
		list_2 |= {(n + j) % 360, (n - j) % 360}
	list_1 = copy.copy(list_2)
if 0 in list_1:
	print('YES')
else:
	print('NO')


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq 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 tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
flag = False

def check(pos, cur):
	global flag
	if cur < n:
		check((pos + a[cur]) % 360, cur + 1)
		check((pos - a[cur]) % 360, cur + 1)
	elif pos == 0:
		flag = True
n = Int()
a = []
for i in range(n):
	a.append(Int())
pos = 0
check(pos, 0)
if flag:
	print('YES')
else:
	print('NO')


import itertools
t = int(input())
total_sum = 0
a = []
for i in range(t):
	a.append(int(input()))
	total_sum += a[i]
if total_sum % 360 == 0:
	print('YES')
else:
	a.sort()
	all_possible = [''.join(seq) for seq in itertools.product('01', repeat=t)]
	flag = -1
	for i in range(len(all_possible)):
		sum_target = 0
		for j in range(len(all_possible[i])):
			if all_possible[i][j] == '0':
				sum_target += a[j]
			else:
				sum_target -= a[j]
		if sum_target == 0 or sum_target % 360 == 0:
			flag = 1
	if flag == 1:
		print('YES')
	else:
		print('NO')


def recursive(soma, i):
	if i == n:
		if soma % 360 == 0:
			return 1
		return 0
	return max(recursive(soma + lista[i], i + 1), recursive(soma - lista[i], i + 1))
n = int(input())
lista = []
for i in range(n):
	lista.append(int(input()))
resp = recursive(0, 0)
if resp == 1:
	print('YES')
else:
	print('NO')


n = int(input())

def Solve(n, Rot):
	for x in range(2 ** n):
		Sum = 0
		x = list(bin(x).replace('0b', ''))
		while len(x) < n:
			x.insert(0, '0')
		for i in range(n):
			if x[i] == '0':
				Sum += Rot[i]
			else:
				Sum -= Rot[i]
		if Sum % 360 == 0:
			return 'YES'
	return 'NO'
Rot = []
for i in range(n):
	Rot.append(int(input()))
print(Solve(n, Rot))


def f(lis, init):
	init = init % 360
	if len(lis) == 1:
		if (lis[0] + init) % 360 == 0 or (lis[0] - init) % 360 == 0:
			return True
		else:
			return False
	return f(lis[1:], lis[0] + init) or f(lis[1:], lis[0] - init)
n = int(input())
lis = [int(input()) for _ in range(n)]
if f(lis, 0):
	print('YES')
else:
	print('NO')


n = int(input())
deg = [int(input()) for i in range(n)]

def get_bin(dec):
	ch = bin(dec)[2:]
	ch = '0' * (n - len(ch)) + ch
	return ch

def get_sum(num):
	summ = 0
	ind = 0
	for i in num:
		if i == '1':
			summ += deg[ind]
		else:
			summ -= deg[ind]
		ind += 1
	return summ
for i in range(2 ** n):
	num = get_bin(i)
	summ = get_sum(num)
	if summ == 0 or summ % 360 == 0:
		print('YES')
		break
else:
	print('NO')


import sys
from itertools import product
n = int(input())
a = [int(input()) for _ in range(n)]
for p in product([1, -1], repeat=n):
	tmp = 0
	for (i, sgn) in enumerate(p):
		tmp += sgn * a[i]
	if tmp % 360 == 0:
		print('YES')
		sys.exit()
print('NO')


n = int(input())
a = []
s = []
t = int(input())
if t == 0:
	print('YES')
	exit()
s.append(t)
for j in range(n - 1):
	t = int(input())
	temp = []
	for i in range(len(s)):
		temp.append(s[i])
		temp.append(s[i])
	s = temp
	for i in range(len(s)):
		if i % 2 == 0:
			s[i] = s[i] + t
		else:
			s[i] = s[i] - t
	s = set(s)
	s = list(s)
k = 0
for i in range(len(s)):
	if s[i] % 360 == 0:
		k = 1
		break
if 0 in s:
	k = 1
if k == 1:
	print('YES')
else:
	print('NO')


n = int(input())
arr = []
for _ in range(n):
	arr.append(int(input()))
yes = False
for i in range(1 << n):
	s = 0
	for j in range(n):
		if i & 1 << j:
			s += arr[j]
		else:
			s -= arr[j]
	if abs(s) % 360 == 0:
		yes = True
		break
print('YES') if yes else print('NO')


def backtracking(rotations, suma):
	if not len(rotations):
		return suma == 0
	a = backtracking(rotations[:-1], (suma + rotations[-1]) % 360)
	b = backtracking(rotations[:-1], (suma - rotations[-1]) % 360)
	return a or b

def B():
	n = int(input())
	rotations = [int(input()) for i in range(n)]
	print('YES' if backtracking(rotations, 0) else 'NO')
B()


def r(x, l, c):
	global a
	global b
	if x >= a - 1:
		c += l
		if c % 360 == 0:
			return '1'
		else:
			return ''
	else:
		return str(r(x + 1, -1 * b[x + 1], l + c)) + str(r(x + 1, b[x + 1], l + c))
a = int(input())
b = []
for i in range(a):
	v = int(input())
	b.append(v)
s = r(0, b[0], 0)
t = r(0, -1 * b[0], 0)
if len(s) == 0 and len(t) == 0:
	print('NO')
else:
	print('YES')


n = int(input())
lis = []
for i in range(n):
	lis.append(int(input()))
done = False
for i in range(1 << n):
	temp = 0
	for j in range(n):
		if 1 << j & i == 0:
			temp += lis[j]
			temp = temp % 360
		else:
			temp -= lis[j]
			temp = temp % 360
	if temp == 0:
		print('YES')
		done = True
		break
if not done:
	print('NO')


a = [0]
for i in range(int(input())):
	d = int(input())
	op = []
	for i in a:
		op.append(d + i)
		op.append(d - i)
	a = op
for i in a:
	if i % 360 == 0:
		print('YES')
		break
else:
	print('NO')


def solve(n, l, i=0, ans=0):
	if i == n:
		if ans == 0 or ans % 360 == 0:
			return True
		else:
			return False
	return solve(n, l, i + 1, ans + l[i]) or solve(n, l, i + 1, ans - l[i])
n = int(input())
l = []
for _ in range(n):
	l.append(int(input()))
ans = solve(n, l)
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
inp = []
for _ in range(n):
	inp.append(int(input()))

def check(inpt, sum):
	if len(inpt) == 0:
		return sum % 360 == 0
	next_item = inpt.pop()
	if check(inpt, sum + next_item) == True:
		return True
	if check(inpt, sum - next_item) == True:
		return True
	inpt.append(next_item)
	return False
if check(inp, 0) == True:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	s = int(input())
	a.append(s)
z = ''
z = z.zfill(n)
itog = 0
for _ in range(2 ** n):
	for j in range(len(z)):
		if z[j] == '0':
			itog += a[j]
			itog = itog % 360
		else:
			itog -= a[j]
			if itog >= 0:
				continue
			else:
				itog = 360 + itog
	if itog == 0:
		print('YES')
		exit()
	z = int(z, base=2)
	z += 1
	z = bin(z)
	z = z[2:]
	z = z.zfill(n)
	itog = 0
print('NO')


from sys import exit
n = int(input())
a = [int(input()) for _ in range(n)]
s = sum(a)
dp = [[0] * (s + 1) for _ in range(n)]
for i in range(n):
	dp[i][0] = 1
	dp[i][a[i]] = 1
dp[0][a[0]] = 1
for i in range(1, n):
	for j in range(1, s + 1):
		if dp[i][j] != 1:
			dp[i][j] = dp[i - 1][j]
			if j - a[i] >= 0 and dp[i][j] == 0:
				dp[i][j] = dp[i - 1][j - a[i]]
for i in range(n):
	for j in range(s + 1):
		if dp[i][j]:
			if abs(j - (s - j)) % 360 == 0:
				print('YES')
				exit()
print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))

def fun(l, k, s):
	global h
	if h == 1:
		return
	if k != len(l):
		s = s + l[k]
		fun(l, k + 1, s)
		if h == 1:
			return
		s = s - 2 * l[k]
		fun(l, k + 1, s)
		return
	elif s % 360 == 0:
		print('YES')
		h = 1
	else:
		return
h = 0
fun(l, 0, 0)
if h == 0:
	print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
p = False
for i in range(2 ** n):
	k = ('0' * 20 + str(bin(i))[2:])[-n:]
	total = 0
	for j in range(n):
		if k[j] == '0':
			total += l[j]
		else:
			total -= l[j]
	if total % 360 == 0:
		p = True
if p:
	print('YES')
else:
	print('NO')


from itertools import combinations
n = int(input())
u = []
for i in range(n):
	u.append(int(input()))
s = sum(u)
ans = s
k = 0
for i in range(n // 2 + 1):
	a = combinations(u, i)
	for j in a:
		s1 = sum(j)
		if abs(s - s1 * 2) % 360 < ans:
			ans = abs(s - s1 * 2) % 360
if ans != 0:
	print('NO')
else:
	print('YES')


n = int(input())
rotate = []
for i in range(n):
	rotate.append(int(input().strip()))

def check(a):
	if a >= 360:
		return a - 360
	if a < 0:
		return a + 360
	else:
		return a

def secret(a, i):
	if i == n:
		if check(a) == 0:
			return True
		else:
			return False
	a1 = a
	a2 = a
	a1 = a1 - rotate[i]
	a2 = a2 + rotate[i]
	a1 = check(a1)
	a2 = check(a2)
	return secret(a1, i + 1) or secret(a2, i + 1)
if secret(0, 0):
	print('YES')
else:
	print('NO')


def vary(n, s, a):
	if len(s) == n:
		a.append(s)
	else:
		vary(n, s + '0', a)
		vary(n, s + '1', a)
	return a
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
k = vary(n, '', [])
j = 0
u = 0
while j < len(k) and u == 0:
	s = 0
	for h in range(n):
		if k[j][h] == '0':
			s -= a[h]
		else:
			s += a[h]
	if s % 360 == 0:
		u = 1
	else:
		j += 1
if u == 0:
	print('NO')
else:
	print('YES')


n = int(input())
a = [0] * n
for i in range(n):
	a[i] = int(input())
b1 = [False] * 360
b2 = [False] * 360
b1[0] = True
for x in a:
	for i in range(360):
		b2[i] = b1[(i - x) % 360] or b1[(i + x) % 360]
	(b1, b2) = (b2, b1)
print('YES' if b1[0] else 'NO')


n = int(input())
if n == 1:
	print('NO')
else:
	s = {int(input())}
	new_s = set()
	for k in range(n - 2):
		q = int(input())
		for x in s:
			new_s.add(x - q)
			new_s.add(x + q)
		s = new_s
		new_s = set()
	final_step = int(input())
	p = 0
	for y in s:
		if (y - final_step) % 360 == 0 or (y + final_step) % 360 == 0:
			p = -1
			print('YES')
			break
	if p == 0:
		print('NO')


def norm(n):
	return (n + 360) % 360
clock = []
n = int(input())
dp = [[-1 for _ in range(360)] for _ in range(n + 1)]

def dfs(i, j):
	global clock, n, dp
	if i >= n:
		if j == 0:
			dp[i][j] = 1
			return True
		dp[i][j] = 0
		return False
	if dp[i][j] != -1:
		return dp[i][j] == 1
	r = dfs(i + 1, norm(j + clock[i]))
	if r:
		dp[i][j] = 1
		return True
	r = dfs(i + 1, norm(j - clock[i]))
	if r:
		dp[i][j] = 1
		return True
	dp[i][j] = 0
	return False
for i in range(n):
	clock.append(int(input()))
print('YES' if dfs(0, 0) else 'NO')


n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
for i in range(1 << n):
	x = 0
	b = list(bin(i)[2:])
	for num in a[::-1]:
		if b and b[-1] == '1':
			x += num
		else:
			x -= num
		if b:
			b.pop()
	if x % 360 == 0:
		print('YES')
		exit()
print('NO')


def decToBinary(n, nof):
	bn = []
	while n > 0:
		bn.append(n % 2)
		n = int(n / 2)
	res = [0 for i in range(nof)]
	res[nof - len(bn):] = bn[::-1]
	return res
n = int(input())
types = pow(2, n)
i = 0
a = []
for k in range(n):
	a.append(int(input()))
while i < types:
	sum = 0
	p = decToBinary(i, n)
	for j in range(n):
		if p[j] == 0:
			sum += a[j]
			sum %= 360
		else:
			sum += 360 - a[j]
	if sum == 0 or sum == 360:
		print('YES')
		exit()
		break
	i += 1
print('NO')


import copy as cp
(rotationCount, rotations) = (int(input()), [])
for i in range(rotationCount):
	rotations.append(int(input()))
masks = []
for i in range(pow(2, rotationCount)):
	masks.append(list(format(i, '0' + str(rotationCount) + 'b')))
sign = {'0': +1, '1': -1}

def yieldsZeroSum(bitMask):
	sum = 0
	for i in range(len(bitMask)):
		sum += sign[bitMask[i]] * rotations[i]
	return sum % 360 == 0
(index, found) = (0, False)
while not found and index < len(masks):
	if yieldsZeroSum(masks[index]):
		found = not found
	else:
		index = index + 1
print('YES') if found else print('NO')


gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()
L = [int(input()) for e in range(n)]
memo = [[-1] * 361 for e in range(n)]

def dp(idx, v):
	if memo[idx][v] != -1:
		return memo[idx][v]
	if idx == n - 1:
		return (v + L[idx]) % 360
	if dp(idx + 1, (v + L[idx]) % 360) == 0:
		memo[idx][v] = 0
		return 0
	memo[idx][v] = dp(idx + 1, (v - L[idx] + 360) % 360)
	return memo[idx][v]
print('YNEOS'[dp(0, 0) != 0::2])


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
found = False
for i in range(1, 2 ** n + 1):
	sum = 0
	for j in range(n):
		if i & 1 << j:
			sum += a[j]
		else:
			sum -= a[j]
	if sum % 360 == 0:
		found = True
		break
if found:
	print('YES')
else:
	print('NO')


n = int(input())
arr = [int(input()) for _ in range(n)]

def f(i, cur):
	if i == n:
		if cur % 360 == 0:
			return True
		else:
			return False
	return f(i + 1, cur - arr[i]) or f(i + 1, cur + arr[i])
print('YES' if f(0, 0) else 'NO')


n = int(input())
stats = [[False for c in range(n)] for r in range(360)]
x = int(input())
stats[x][0] = True
stats[360 - x][0] = True
for i in range(1, n):
	x = int(input())
	for r in range(0, 360):
		if stats[r][i - 1] == True:
			right = (r + x) % 360
			left = (r - x + 360) % 360
			stats[right][i] = True
			stats[left][i] = True
if stats[0][n - 1] == True:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for _ in range(0, n):
	a.append(int(input()))
a.sort()
ans = [0]
temp = []
for i in range(0, n):
	temp = []
	for j in range(0, len(ans)):
		temp.append((ans[j] + a[i]) % 360)
	for j in range(0, len(ans)):
		temp.append((ans[j] - a[i]) % 360)
	ans = temp
if 0 in ans:
	print('YES')
else:
	print('NO')


def rotate(moves, prevAngle):
	if not len(moves):
		if prevAngle % 360 == 0:
			return True
		return False
	return rotate(moves[1:], prevAngle - moves[0]) or rotate(moves[1:], prevAngle + moves[0])
n = int(input())
moves = []
while n:
	moves.append(int(input()))
	n -= 1
can = rotate(moves, 0)
print('YES') if can else print('NO')


n = int(input())
a = [0] * n
for i in range(n):
	a[i] = int(input())

def foo(n, s, t):
	if n == 1:
		s += a[t]
		if s % 360 == 0:
			return True
		else:
			s -= 2 * a[t]
			if s % 360 == 0:
				return True
			else:
				return False
	elif n == 0:
		return
	elif n > 1:
		return foo(n - 1, s + a[t], t + 1) or foo(n - 1, s - a[t], t + 1)
if foo(n, 0, 0):
	print('YES')
else:
	print('NO')


def dfs(i, b):
	if i == len(li):
		return b % 360 == 0
	return dfs(i + 1, b + li[i]) or dfs(i + 1, b - li[i])
tcase = int(input())
li = []
for case in range(tcase):
	a = int(input())
	li.append(a)
li.sort(reverse=True)
tmp = sum(li)
flag = dfs(0, 0)
if flag == False:
	print('NO')
elif flag == True:
	print('YES')


def recursor(theList, currentAns, currentDone, n):
	if currentDone == n:
		if currentAns % 360 == 0:
			return True
		else:
			return False
	elif recursor(theList, currentAns + theList[currentDone], currentDone + 1, n):
		return True
	elif recursor(theList, currentAns - theList[currentDone], currentDone + 1, n):
		return True
	else:
		return False
n = int(input())
a = []
for z in range(n):
	inp = int(input())
	a.append(inp)
if sum(a) % 360 == 0:
	print('YES')
elif sum(a) % 2 == 1:
	print('NO')
elif recursor(a, 0, 0, n):
	print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline
from math import ceil, floor, factorial

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

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 swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

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
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
for mask in range(1 << n):
	sub = 0
	for i in range(n):
		if mask & 1 << i:
			sub += a[i]
		else:
			sub -= a[i]
	if sub % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
c = []

def dfs(idx, total, state):
	if state == '+':
		total += c[idx]
	else:
		total -= c[idx]
	total = total % 360
	if idx == len(c) - 1:
		if total == 0:
			return True
		else:
			return False
	else:
		return dfs(idx + 1, total, '+') or dfs(idx + 1, total, '-')
while n > 0:
	n -= 1
	tmp = int(input())
	c.append(tmp)
if dfs(0, 0, '+') or dfs(0, 0, '-'):
	print('YES')
else:
	print('NO')


n = int(input())
list_angles = []
for k in range(n):
	list_angles.append(int(input()))

def do_rotations(binary_k):
	rot = 0
	for i in range(n):
		pm = binary_k[i] * 2 - 1
		rot += pm * list_angles[i]
	return rot % 360 == 0

def test_rotations():
	for k in range(2 ** n):
		binary_k = list(map(int, list(bin(k)[2:])))
		while len(binary_k) < n:
			binary_k = [0] + binary_k
		if do_rotations(binary_k):
			return True
	return False
if test_rotations():
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(input()) for i in range(n)]
ok = [False for i in range(360)]
ok[0] = True
for i in range(n):
	ok2 = [False for i in range(360)]
	for j in range(360):
		if ok[j]:
			ok2[(j + a[i]) % 360] = True
			ok2[(j - a[i]) % 360] = True
	ok = ok2[:]
if ok[0]:
	print('YES')
else:
	print('NO')


n = int(input())
d = []
for i in range(n):
	d.append(int(input()))
for i in range(1 << n):
	num = 0
	for j in range(n):
		if i & 1 << j:
			num += d[j]
		else:
			num -= d[j]
	if num % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
l = [0]
for i in range(n):
	a = int(input())
	l2 = []
	for x in l:
		l2.extend([x + a, x - a])
	l = l2
print(('NO', 'YES')[any([x % 360 == 0 for x in l])])


n = int(input())
a = n * [0]
for i in range(n):
	a[i] = int(input())
q = [[0, 0]]
f = 0
while q:
	w = q.pop(0)
	if w[0] == n and w[1] % 360 == 0:
		f = 1
		break
	if w[0] != n:
		q = [[w[0] + 1, w[1] + a[w[0]]]] + q
		q = [[w[0] + 1, w[1] - a[w[0]]]] + q
if f:
	print('YES')
else:
	print('NO')


a = int(input())
b = []
res = False
for i in range(0, a):
	b.append(int(input()))
for i in range(0, 2 ** a):
	s = str(bin(i)[2:]).zfill(a)
	tmp = 0
	for j in range(0, a):
		if s[j] == '0':
			tmp += b[j]
		else:
			tmp -= b[j]
	if tmp % 360 == 0:
		res = True
if res == True:
	print('YES')
else:
	print('NO')


from sys import stdin
input = stdin.readline
I = lambda : list(map(int, input().split()))
(n,) = I()
l = []
for i in range(n):
	(k,) = I()
	l.append(k)
f = 0
for i in range(1 << n):
	k = 0
	for j in range(n):
		if i >> j & 1:
			k += l[j]
		else:
			k -= l[j]
	if k % 360 == 0:
		f = 1
		break
print('NYOE S'[f::2])


import sys
data = sys.stdin.read().splitlines()
n = int(data[0])
nums = [int(line) for line in data[1:]]
end = 1 << n
for cur in range(end):
	cnt = 0
	for i in range(n):
		if cur & 1 << i:
			cnt += nums[i]
		else:
			cnt -= nums[i]
	if cnt % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = list((int(input()) % 360 for _ in range(0, n)))
dp = {0}
for i in a:
	dp2 = set()
	for j in dp:
		dp2.add((j + i + 360) % 360)
		dp2.add((j - i + 360) % 360)
	dp = dp2
print('YES' if 0 in dp else 'NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
dp = [[False for i in range(6000)] for j in range(16)]
dp[0][3000] = True
for i in range(n):
	for j in range(200, 5800):
		dp[i + 1][j + a[i]] = dp[i][j] or dp[i + 1][j + a[i]]
		dp[i + 1][j - a[i]] = dp[i][j] or dp[i + 1][j - a[i]]
flag = 0
for i in range(9):
	if dp[n][3000 + 360 * i] or dp[n][3000 - 360 * i]:
		flag = 1
if flag == 1:
	print('YES')
else:
	print('NO')


from sys import stdin
input = lambda : stdin.readline()

def aise(a, l):
	z = []
	for i in l:
		z.append(i + a)
		z.append(i - a)
	return z
n = int(input())
l = [0]
for i in range(n):
	l = aise(int(input()), l)
flag = 0
for i in l:
	if i % 360 == 0:
		flag = 1
if flag:
	print('YES')
else:
	print('NO')


a = list()
n = int(input())
f = 0
for i in range(0, n):
	a.append(int(input()) % 360)
for i in range(0, 2 ** n):
	s = 0
	num = i + 2 ** 16
	for j in range(0, n):
		if bin(num)[18 - j] == '1':
			s += a[j]
		else:
			s -= a[j]
	if s % 360 == 0:
		f = 1
		print('YES')
		break
if f == 0:
	print('NO')


from itertools import product
n = int(input())
combos = product([1, -1], repeat=n)
rotations = []
for i in range(n):
	rotations.append(int(input()))
while True:
	try:
		pos = 0
		combo = next(combos)
		for x in range(len(combo)):
			pos += combo[x] * rotations[x]
		if pos % 360 == 0:
			print('YES')
			break
	except:
		print('NO')
		break


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
s = sum(l)
out = False
for test in range(pow(2, n)):
	snew = sum([l[i] for i in range(n) if test & pow(2, i) != 0])
	if (s - 2 * snew) % 360 == 0:
		out = True
		break
if out:
	print('YES')
else:
	print('NO')


n = int(input())
nums = []
for _ in range(n):
	now = int(input())
	nums.append(now)
ans = [0]

def check(left, index):
	if index == len(nums):
		if left == 0 or left % 360 == 0:
			ans[0] = 1
			print('YES')
			exit()
	else:
		check(left - nums[index], index + 1)
		check(left + nums[index], index + 1)
check(0, 0)
print('NO')


n = int(input())
degs = []
for i in range(n):
	degs.append(int(input()))
res = False

def cnt(now, i):
	if i == n and now % 360 == 0:
		res = True
		return True
	elif i < n:
		return cnt(now + degs[i], i + 1) or cnt(now - degs[i], i + 1)
if cnt(0, 0) == True:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
from math import sin, tan, cos, pi, atan2, sqrt, acos, atan, factorial
from random import randint
N = 360
n = int(stdin.readline())
dp = [[0 for i in range(N)] for j in range(20)]
dp[0][0] = 1
cur = 0
vl = []
for i in range(n):
	vl.append(int(stdin.readline()))
for v in vl:
	for i in range(N):
		if not dp[cur][i]:
			continue
		dp[cur + 1][(i + v) % N] = 1
		dp[cur + 1][(i - v) % N] = 1
	cur += 1
if dp[cur][0]:
	stdout.write('YES\n')
else:
	stdout.write('NO\n')


def solve(rotations, angle, i=0, memo={}):
	if i == len(rotations):
		if angle == 0:
			return True
		else:
			return False
	else:
		if (i, angle) not in memo:
			memo[i, angle] = solve(rotations, (angle - rotations[i]) % 360, i + 1, memo) or solve(rotations, (angle + rotations[i]) % 360, i + 1, memo)
		return memo[i, angle]

def lit(res):
	if res:
		return 'YES'
	else:
		return 'NO'
n = int(input())
rotations = [int(input()) for i in range(n)]
print(lit(solve(rotations, 0, 0, {})))


n = int(input())
arr = []
for i in range(n):
	d = int(input())
	arr.append(d)
flag = 0
for i in range(2 ** n):
	b = bin(i)[2:]
	zer = n - len(b)
	fin = '0' * zer + b
	ans = 0
	for i in range(n):
		if fin[i] == '0':
			ans += arr[i]
		else:
			ans -= arr[i]
	if ans < 0:
		ans = -ans
	if ans == 0 or ans % 360 == 0:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


def dv(n):
	ans = []
	now = 1
	while now <= n:
		now *= 2
	now //= 2
	while now != 0:
		if n >= now:
			n -= now
			ans.append(1)
		else:
			ans.append(-1)
		now //= 2
	ans = ans[::-1]
	for i in range(16):
		ans.append(-1)
	return ans
n = int(input())
l = []
ans = 'NO'
for i in range(n):
	l.append(int(input()))
i = 0
while i <= 2 ** n - 1 and ans == 'NO':
	what = dv(i)
	summ = 0
	for j in range(n):
		summ = what[j] * l[j] + summ
	if summ % 360 == 0:
		ans = 'YES'
	i += 1
print(ans)


n = int(input())
l1 = [0]
m = (1 << n + 1) - 1
depth = 0
i = 0
while depth < n:
	p = int(input())
	t = 1 << depth
	while t >= 1:
		l1.append((l1[i] + p) % 360)
		l1.append((l1[i] - p) % 360)
		i += 1
		t -= 1
	depth += 1
l = (1 << n - 1) * -1
if 0 in l1[l:]:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	x = int(input())
	a.append(x)
flag = False
for i in range(2 ** n):
	s = bin(i)[::-1][:-2]
	s += '0' * (n - len(s))
	s1 = 0
	s2 = 0
	j = 0
	while j < n:
		if s[j] == '1':
			s1 = (s1 + a[j]) % 360
		else:
			s2 = (s2 + a[j]) % 360
		j += 1
	if s1 == s2:
		flag = True
if flag:
	print('YES')
else:
	print('NO')


k = int(input())
a = [int(input()) for _ in range(k)]
for i in range(1, 1 << k + 1):
	c = ''
	for j in range(k):
		c += str(min(i & 1 << j, 1))
	current = 0
	for (i, d) in zip(c, a):
		if i == '0':
			current += d
		else:
			current -= d
	if current % 360 == 0:
		print('YES')
		exit()
print('NO')


def f(i, c):
	if i == n:
		return c % 360
	a = f(i + 1, c + L[i])
	b = f(i + 1, c - L[i])
	if a == 0 or b == 0:
		return 0
	else:
		return -1
n = int(input())
L = []
for i in range(n):
	L.append(int(input()))
if not f(0, 0):
	print('yes')
else:
	print('no')


try:
	from itertools import combinations
	n = int(input())
	l = []
	for _ in range(n):
		l.append(int(input()))
	s = sum(l)
	f = 0
	for _ in range(1, len(l) + 1, 1):
		nl = list(combinations(l, _))
		for i in nl:
			ts = sum(i)
			if abs(s - 2 * ts) % 360 == 0:
				print('YES')
				f = 1
				break
			else:
				continue
		if f == 1:
			break
		else:
			continue
	else:
		print('NO')
except:
	pass


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))

def possible(i, c):
	global n
	if i == n:
		if c == 0:
			return True
		return False
	global l
	return possible(i + 1, c=(c + l[i]) % 360) or possible(i + 1, c=(360 + c - l[i]) % 360)
if possible(0, 0):
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(input()) for i in range(n)]
f = 0
for i in range(2 ** n - 1):
	x = bin(i)[2:]
	y = '0' * (n - len(x)) + x
	c = 0
	for j in range(n):
		if y[j] == '0':
			c += a[j]
		else:
			c -= a[j]
	if c % 360 == 0:
		f = 1
		print('YES')
		break
if f == 0:
	print('NO')


n = int(input())
x = int(input())
p = [abs(x), -abs(x)]
for i in range(n - 1):
	x = int(input())
	p1 = [(pp + x) % 360 for pp in p]
	p2 = [(pp - x) % 360 for pp in p]
	p = p1 + p2
if 0 in p:
	print('YES')
else:
	print('NO')


n = int(input(''))
nums = []
for i in range(n):
	nums.append(int(input('')))
for bit in range(2 ** n):
	temp = 0
	for i in range(n):
		t = nums[i]
		if bit & 2 ** i:
			temp += t
		else:
			temp -= t
	if temp % 360 == 0:
		print('YES')
		exit()
print('NO')


import math

def printsubsequences(a, n):
	opsize = math.pow(2, n)
	for i in range(1, int(opsize)):
		temp = 0
		for j in range(0, n):
			if i & 1 << j:
				temp += a[j]
		if temp == sum(a) // 2:
			print('YES')
			exit()
		if abs(2 * temp - sum(a)) % 360 == 0:
			print('YES')
			exit()
	print('NO')
n = int(input())
a = []
for i in range(n):
	y = int(input())
	a.append(y)
if sum(a) % 2 == 0:
	printsubsequences(a, n)
else:
	print('NO')


n = int(input())
a = [0]
for i in range(n):
	m = int(input())
	new = []
	for j in a:
		new.extend([j + m, j - m])
	a = new[:]
print('yes' if any((c % 360 == 0 for c in a)) else 'no')


def mi():
	return map(int, input().split())
n = int(input())
a = [0] * n
for i in range(n):
	a[i] = int(input())
for i in range(2 ** n):
	s = 0
	k = 0
	for j in range(n):
		if i % 2 == 0:
			s += a[k]
		else:
			s -= a[k]
		k += 1
		i //= 2
	if s % 360 == 0:
		print('YES')
		exit(0)
print('NO')


n = int(input())
sum1 = 0
a = []
tree = []
for _ in range(n):
	p = int(input())
	a.append(p)
	sum1 += p
if sum1 % 360 == 0:
	print('YES')
else:
	tree.append(-a[0])
	tree.append(a[0])
	i = 1
	m = 0
	while i < n:
		x = int(pow(2, i))
		for j in range(m, m + x):
			tree.append(tree[j] - a[i])
			tree.append(tree[j] + a[i])
		i += 1
		m += x
	flag = 0
	final = int(pow(2, n))
	for j in range(1, final + 1):
		if tree[-j] % 360 == 0:
			flag = 1
			print('YES')
			break
	if flag == 0:
		print('NO')


import copy
n = int(input())
k = int(input())
z = [k, -k]
for _ in range(n - 1):
	t = copy.deepcopy(z)
	k = int(input())
	for i in range(len(z)):
		z[i] += k
		t[i] -= k
	z = z + t
for i in z:
	if i % 360 == 0:
		print('YES')
		exit()
print('NO')


get_to = [False for _ in range(360)]
get_to[0] = True
n = int(input())
for i in range(n):
	num = int(input())
	get_to2 = [False for _ in range(360)]
	for k in range(360):
		if get_to[k]:
			get_to2[(k + num) % 360] = True
			get_to2[(k - num) % 360] = True
	get_to = get_to2
if get_to[0]:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
b = [a[0], 360 - a[0]]
for i in range(1, len(a)):
	c = []
	ele = a[i]
	for j in range(len(b)):
		c.append((b[j] + ele) % 360)
		c.append((b[j] - ele + 360) % 360)
	b = c
flag = 0
for i in b:
	if i == 0:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


def dfs(x, s):
	if x == n:
		return s % 360 == 0
	return dfs(x + 1, s + a[x + 1]) or dfs(x + 1, s - a[x + 1])
n = int(input(''))
a = [-1] * 20
for i in range(0, n):
	a[i + 1] = int(input(''))
print('YES' if dfs(0, 0) else 'NO')


n = int(input().strip())
ans = [int(input().strip()) for _ in range(n)]
vs = {'s': 0}
for a in ans:
	vs_new = {}
	for key in vs:
		for v in [0, 1]:
			t = vs[key]
			if v == 0:
				t += a
			else:
				t -= a
			key_new = str(key) + str(v)
			vs_new[key_new] = t
	vs = vs_new
is_found = False
for key in vs:
	if vs[key] % 360 == 0:
		print('YES')
		is_found = True
		break
if not is_found:
	print('NO')


import sys
n = int(input())
a = list(map(int, sys.stdin))
for bit in range(2 ** n):
	if sum((v if 2 ** i & bit else -v for (i, v) in enumerate(a))) % 360 == 0:
		print('YES')
		exit()
print('NO')


from sys import stdin, stdout, setrecursionlimit
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return input()

def num():
	return int(input())

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

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

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

def pmat(A):
	for ele in A:
		print(*ele, end='\n')

def seive():
	prime = [1 for i in range(10 ** 6 + 1)]
	prime[0] = 0
	prime[1] = 0
	for i in range(10 ** 6 + 1):
		if prime[i]:
			for j in range(2 * i, 10 ** 6 + 1, i):
				prime[j] = 0
	return prime
n = int(data())
lock = []
for _ in range(n):
	lock.append(int(data()))
sum = 0

def dp(lock, n, sum, i):
	if n == i:
		if sum % 360 == 0:
			return 1
		return 0
	k1 = dp(lock, n, sum + lock[i], i + 1)
	k2 = dp(lock, n, sum - lock[i], i + 1)
	return max(k1, k2)
print('YES' if dp(lock, n, sum, 0) else 'NO')
endtime = time.time()


n = int(input())
a = []
for _ in range(n):
	k = int(input())
	a.append(k)
b = ['0', '1']
for i in range(n - 1):
	c = []
	for i in b:
		c.append('0' + i)
	for i in b:
		c.append('1' + i)
	b = c
p = 0
for i in b:
	l = 0
	for j in range(n):
		if i[j] == '0':
			l -= a[j]
		if i[j] == '1':
			l += a[j]
	if l % 360 == 0:
		p = p + 1
		break
if p == 1:
	print('YES')
else:
	print('NO')


def isPossible(curr, i, n, rot):
	if i == n:
		return curr == 0
	return isPossible((curr + rot[i]) % 360, i + 1, n, rot) or isPossible((curr - rot[i]) % 360, i + 1, n, rot)
n = int(input())
rot = []
for i in range(n):
	rot.append(int(input()))
if isPossible(0, 0, n, rot):
	print('YES')
else:
	print('NO')


def subsetsum(a, l, r, p, s=0):
	if l > r:
		p.append((s % 360, (z - s) % 360))
		return
	subsetsum(a, l + 1, r, p, s + a[l])
	subsetsum(a, l + 1, r, p, s)
n = int(input())
a = []
p = []
for i in range(n):
	q = int(input())
	a.append(q)
z = sum(a)
if sum(a) % 360 == 0:
	print('YES')
else:
	subsetsum(a, 0, n - 1, p)
	l = 0
	for (i, j) in p:
		if i == j:
			l = 1
			print('YES')
			break
	if l == 0:
		print('NO')


from collections import defaultdict
from sys import stdin, stdout
n = int(input())

def find(a, val, curr):
	if curr == n:
		if val % 360 == 0:
			return True
		else:
			return False
	else:
		return find(a, val + a[curr], curr + 1) or find(a, val - a[curr], curr + 1)
a = []
for _ in range(n):
	a.append(int(input()))
initial = 0
if find(a, initial, 0):
	print('YES')
else:
	print('NO')


import array as arr
n = int(input())
(x, p) = ([], [])
c = 'p'
k = int(input())
p.append(k)
p.append(-k)
n -= 1
while n > 0:
	k = int(input())
	if c == 'p':
		for i in range(len(p)):
			x.append(p[i] + k)
			x.append(p[i] - k)
		c = 'x'
		p = []
	else:
		for i in range(len(x)):
			p.append(x[i] + k)
			p.append(x[i] - k)
		c = 'p'
		x = []
	n -= 1
a = 0
for i in range(len(p)):
	if p[i] % 360 == 0:
		print('YES')
		a = 1
		break
for i in range(len(x)):
	if x[i] % 360 == 0:
		print('YES')
		a = 1
		break
if a == 0:
	print('NO')


n = int(input())
A = set([0])
for _ in range(n):
	m = int(input())
	B = set()
	for x in A:
		z = x + m
		if z > 360:
			z -= 360
		B.add(z)
		z = x - m
		if z < 0:
			z += 360
		B.add(z)
	A = B
print('YES' if 0 in A else 'NO')


def solve(a, n, sum, x):
	if x == n:
		if sum % 360 == 0:
			return True
		else:
			return False
	c = sum + a[x]
	d = sum - a[x]
	b = solve(a, n, c, x + 1)
	e = solve(a, n, d, x + 1)
	return b or e
n = int(input())
a = list((int(input()) for x in range(n)))
if solve(a, n, 0, 0):
	print('YES')
else:
	print('NO')


def knap(b, i):
	if i == n:
		return b % 360 == 0
	else:
		return knap(b + A[i], i + 1) or knap(b - A[i], i + 1)
n = int(input())
A = [int(input()) for i in range(n)]
if knap(0, 0):
	print('Yes')
else:
	print('No')


n = int(input())
a = [int(input()) for i in range(n)]
for i in range(2 ** n):
	su = 0
	for j in range(n):
		if 1 << j | i != i:
			su += a[j]
		else:
			su -= a[j]
	if su % 360 == 0:
		print('YES')
		exit(0)
print('NO')


def solve(r, pos):
	if pos == n:
		if r == 0:
			return True
		else:
			return False
	else:
		g1 = (r + O[pos]) % 360
		g2 = (r - O[pos]) % 360
		if solve(g1, pos + 1) or solve(g2, pos + 1):
			return True
		else:
			return False
n = int(input())
O = []
for a in range(n):
	O.append(int(input()))
if solve(0, 0):
	print('YES')
else:
	print('NO')


def sol():
	a = int(input())
	x = [int(input()) for i in range(a)]
	for i in range(1 << a):
		w = 0
		for j in range(a):
			if i >> j & 1:
				w += x[j]
			else:
				w -= x[j]
		if w % 360 == 0:
			return not print('yes')
	print('no')
sol()


import sys
l = []
for _ in range(int(sys.stdin.readline())):
	l.append(int(sys.stdin.readline()))

def test(acc, i):
	if i == len(l):
		yield acc
	else:
		yield from test(acc + l[i], i + 1)
		yield from test(acc - l[i], i + 1)
found = False
for x in test(0, 0):
	if x % 360 == 0:
		found = True
		break
if found:
	print('YES')
else:
	print('NO')


n = int(input())
s = 0
ar = []
for k in range(n):
	ar.append(int(input()))
for i in range(0, 2 ** n):
	n2 = i
	s = 0
	for j in range(0, n):
		if n2 % 2 == 0:
			s = s - ar[j]
			n2 = n2 // 2
		else:
			s = s + ar[j]
			n2 = n2 // 2
	if s % 360 == 0:
		print('YES')
		exit()
print('NO')


from collections import Counter, defaultdict, deque
import heapq as hq
import math
import sys
input = sys.stdin.readline

def rec(a, cur, depth):
	if depth == len(a):
		return False
	nxt = a[depth]
	if depth == len(a) - 1 and ((cur + nxt) % 360 == 0 or (cur - nxt) % 360 == 0):
		return True
	return rec(a, cur + nxt, depth + 1) or rec(a, cur - nxt, depth + 1)

def solve():
	n = int(input())
	arr = []
	for i in range(n):
		arr.append(int(input()))
	print('yes' if rec(arr, 0, 0) else 'no')
tt = 1
for test in range(tt):
	solve()


num_n = int(input())
arr = []
for i in range(num_n):
	arr.append(int(input()))
total_mv = len(arr)

def rec(deg, num_mv):
	if num_mv == total_mv:
		return deg == 0
	s1 = rec((deg + arr[num_mv]) % 360, num_mv + 1)
	s2 = rec((deg - arr[num_mv]) % 360, num_mv + 1)
	return s1 or s2
if rec(0, 0):
	print('YES')
else:
	print('NO')


from itertools import product as prd
n = int(input())
l = [int(input()) for i in range(n)]
s = '{}'.join(map(str, l))
p = prd('+-', repeat=n)
if sum(l) >= 360:
	for i in p:
		if not eval(s.format(*i)) % 360:
			print('YES')
			break
	else:
		print('NO')
else:
	for i in p:
		if not eval(s.format(*i)):
			print('YES')
			break
	else:
		print('NO')


from sys import setrecursionlimit
setrecursionlimit(1000000)

def pereb(s, i):
	s %= 360
	if i == n:
		return s == 0
	return pereb(s - mas[i], i + 1) or pereb(s + mas[i], i + 1)
n = int(input())
mas = [int(input()) for i in range(n)]
if pereb(0, 0):
	print('YES')
else:
	print('NO')


rotations = int(input())
potentialRotations = [0]
for i in range(rotations):
	step = int(input())
	collectRotations = []
	for r in potentialRotations:
		collectRotations.append(r - step)
		collectRotations.append(r + step)
	potentialRotations = collectRotations
for j in potentialRotations:
	if j % 360 == 0:
		print('YES')
		exit(0)
print('NO')


def roda(atual, arr):
	if arr == []:
		if atual == 0:
			global deslocked
			deslocked = 'YES'
			return True
	else:
		valor = arr[0]
		at1 = (atual + valor) % 360
		at2 = (atual - valor) % 360
		roda(at1, arr[1:])
		roda(at2, arr[1:])
deslocked = 'NO'
rotacoes = int(input())
graus = []
for i in range(rotacoes):
	graus.append(int(input()))
roda(0, graus)
print(deslocked)


from itertools import product
n = int(input())
rotates = []
for i in range(n):
	a = int(input())
	rotates.append(a)
variants = list(product([0, 1], repeat=n))
for var in variants:
	sum = 0
	for (index, value) in enumerate(rotates):
		sum += value if var[index] else -value
	if sum % 360 == 0 or sum == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
flag = False
arr = []
for i in range(n):
	arr.append(int(input()))
for mask in range(0, 1 << n):
	temp_total = 0
	for i in range(n):
		if mask & 1 << i:
			temp_total += arr[i]
		else:
			temp_total -= arr[i]
	if temp_total % 360 == 0:
		flag = True
if flag:
	print('YES')
else:
	print('NO')


from sys import stdin
input = stdin.readline

def get_nth_bit(x, n):
	return x >> n & 1
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
for i in range(2 ** n):
	pos = 0
	for j in range(n):
		if get_nth_bit(i, j) == 1:
			pos = (pos + a[j]) % 360
		else:
			pos = (pos - a[j]) % 360
	if pos == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
degrees = []
for i in range(n):
	degrees.append(int(input()))
found = False
m = 1 << n
for i in range(m):
	sum = 0
	for j in range(n):
		if 1 << j & i:
			sum += degrees[j]
		else:
			sum -= degrees[j]
	if sum % 360 == 0:
		print('YES')
		found = True
		break
if not found:
	print('NO')


n = int(input())
aas = []
for _ in range(n):
	a = int(input())
	aas.append(a)

def possible_values(v):
	if len(v) == 1:
		return [v[0] % 360]
	else:
		(first, rest) = (v[0], v[1:])
		ys = possible_values(rest)
		zs = [first + y for y in ys] + [-first + y for y in ys]
		zs = list(set([z % 360 for z in zs]))
		return zs
if 0 in possible_values(aas):
	print('YES')
else:
	print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
d = {}

def lock(angle, i, l, n):
	if i == n and angle == 0:
		return True
	if i == n and angle != 0:
		return False
	if (angle, i) in d:
		return d[angle, i]
	if angle - l[i] < 0:
		c = angle - l[i]
		counterclockwise = lock(360 + c, i + 1, l, n)
	else:
		counterclockwise = lock(angle - l[i], i + 1, l, n)
	clockwise = lock((angle + l[i]) % 360, i + 1, l, n)
	d[angle, i] = counterclockwise or clockwise
	return counterclockwise or clockwise
print('Yes') if lock(0, 0, l, n) else print('No')


n = int(input())
ar = [int(input()) for x in range(n)]
st = set()
for x in range(1 << 16):
	cur = 0
	for e in range(n):
		if x % 2:
			cur += ar[e]
		else:
			cur -= ar[e]
		x //= 2
	cur %= 360
	if cur == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
(a, ans) = ([], 'NO')
for i in range(n):
	a.append(int(input()))
for c in range(2 ** n):
	angl = 0
	for i in range(n):
		if c & 2 ** i:
			angl += a[i]
		else:
			angl -= a[i]
	if angl % 360 == 0:
		ans = 'YES'
		break
print(ans)


def myrec(n, pl, mi, l):
	if n == -1:
		if pl % 360 == mi % 360:
			print('YES')
			exit()
		return
	for i in range(2):
		if i == 0:
			pl += l[n]
			myrec(n - 1, pl, mi, l)
		if i == 1:
			pl -= l[n]
			mi += l[n]
			myrec(n - 1, pl, mi, l)
n = int(input())
l = []
pl = 0
mi = 0
for i in range(n):
	l.append(int(input()))
myrec(n - 1, 0, 0, l)
print('NO')


n = int(input())
m = []
for i in range(n):
	m.append(int(input()))
for i in range(15 - n):
	m.append(0)
s = 'NO'
for i1 in range(2):
	for i2 in range(2):
		for i3 in range(2):
			for i4 in range(2):
				for i5 in range(2):
					for i6 in range(2):
						for i7 in range(2):
							for i8 in range(2):
								for i9 in range(2):
									for i10 in range(2):
										for i11 in range(2):
											for i12 in range(2):
												for i13 in range(2):
													for i14 in range(2):
														for i15 in range(2):
															if (m[0] + m[1] + m[2] + m[3] + m[4] + m[5] + m[6] + m[7] + m[8] + m[9] + m[10] + m[11] + m[12] + m[13] + m[14] + m[0] * (i1 - 1) * 2 + m[1] * (i2 - 1) * 2 + m[2] * (i3 - 1) * 2 + m[3] * (i4 - 1) * 2 + m[4] * (i5 - 1) * 2 + m[5] * (i6 - 1) * 2 + m[6] * (i7 - 1) * 2 + m[7] * (i8 - 1) * 2 + m[8] * (i9 - 1) * 2 + m[9] * (i10 - 1) * 2 + m[10] * (i11 - 1) * 2 + m[11] * (i12 - 1) * 2 + m[12] * (i13 - 1) * 2 + m[13] * (i14 - 1) * 2 + m[14] * (i15 - 1) * 2) % 360 == 0:
																s = 'YES'
print(s)


n = int(input())
dp = [[] for x in range(360)]
dp[0].append(0)
for x in range(1, n + 1):
	angle = int(input())
	for angle_ok in dp[x - 1]:
		dp[x].append((angle_ok + angle) % 360)
		dp[x].append((angle_ok - angle) % 360)
if 0 in dp[n]:
	print('YES')
else:
	print('NO')


n = int(input())
lst = []
for i in range(n):
	lst.append(int(input()))
for S in range(1 << n):
	beg = 0
	for i in range(n):
		if S & 1 << i:
			beg = (beg + lst[i]) % 360
		else:
			beg = (beg - lst[i]) % 360
	if beg == 0:
		print('YES')
		break
else:
	print('NO')


import sys
num_rotations = int(sys.stdin.readline())
current = [0]
for _ in range(num_rotations):
	rotation = int(sys.stdin.readline())
	next = []
	for element in current:
		next.append(element + rotation)
		next.append(element - rotation)
	current = next
for element in current:
	if element % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
l = []
for i in range(n):
	a = int(input())
	l.append(a)
m = pow(2, n) - 1
flag = 0
for i in range(m):
	c = 0
	for j in range(n):
		if i >> j & 1:
			c = c + l[j]
		else:
			c = c - l[j]
	if c % 360 == 0:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


def solve(i=0, cur=0):
	cur %= 360
	if i == n:
		return cur == 0
	return solve(i + 1, cur - a[i]) or solve(i + 1, cur + a[i])
n = int(input())
a = [int(input()) for _ in range(n)]
print('YES' if solve() else 'NO')


arr = []
for _ in range(int(input().strip())):
	arr.append(int(input().strip()))
n = len(arr)
ans = 'NO'
for i in range(2 ** n):
	x = str(bin(i))[2:]
	x = x.rjust(n, '0')
	new = [i for i in arr]
	for j in range(n):
		if x[j] == '1':
			new[j] *= -1
	total = 0
	for i in new:
		total = (total + i) % 360
	if total % 360 == 0:
		ans = 'YES'
		break
print(ans)


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
fl = 0
for i in range(0, 2 ** n):
	s = ''
	t = i
	while t:
		s += str(t % 2)
		t //= 2
	g = len(s)
	s = '0' * (n - g) + s[::-1]
	suma = 0
	for j in range(n):
		if s[j] == '0':
			suma -= l[j]
		else:
			suma += l[j]
	if suma % 360 == 0:
		print('YES')
		fl = 1
		break
if not fl:
	print('NO')


import getpass
import sys

def ria():
	return [int(i) for i in input().split()]
if getpass.getuser() != 'frohenk':
	filename = 'half'
else:
	sys.stdin = open('input.txt')
n = ria()[0]
ar = []
for i in range(n):
	ar.append(ria()[0])
sm = sum(ar) / 2
for i in range(2 ** n):
	c = 0
	for j in range(n):
		if i & 1 << j:
			c += ar[j]
		else:
			c -= ar[j]
	if c % 360 == 0:
		print('YES')
		exit(0)
print('NO')


n = int(input())
a = [0]
for i in range(n):
	b = int(input())
	l = []
	for j in a:
		l.append(j - b)
		l.append(j + b)
	a = l
for i in a:
	if i == 0 or i % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
s = {0}
for _ in range(n):
	a = int(input())
	x1 = set(((x - a) % 360 for x in s))
	x2 = set(((x + a) % 360 for x in s))
	s = x2 | x1
print('YES' if 0 in s else 'NO')


import sys

def func(val, ans):
	if val == n:
		if ans % 360 == 0 or ans == 0:
			print('YES')
			sys.exit()
		return
	func(val + 1, ans - arr[val])
	func(val + 1, ans + arr[val])
n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
func(0, 0)
print('NO')


n = int(input())
(a, b) = ([0], [])
for i in range(n):
	z = int(input())
	b = []
	for k in a:
		b.append((k + z) % 360)
		b.append((k - z) % 360)
	a = b[:]
if 0 in a:
	print('YES')
else:
	print('NO')


def read(type=1):
	if type:
		file = open('input.dat', 'r')
		n = int(file.readline())
		a = []
		for i in range(n):
			a.append(int(file.readline()))
		file.close()
	else:
		n = int(input().strip())
		a = []
		for i in range(n):
			a.append(int(input().strip()))
	return (n, a)

def check():
	s = 0
	for i in range(n):
		if c[i]:
			s += a[i]
		else:
			s -= a[i]
	if s % 360 == 0:
		return 1

def back():
	if len(c) == n:
		if check():
			return 1
	else:
		for i in range(2):
			c.append(i)
			if back():
				return 1
			c.pop()

def solve():
	if back():
		return 1
	else:
		return 0
c = []
(n, a) = read(0)
if solve():
	print('YES')
else:
	print('NO')


import sys
n = int(sys.stdin.readline().strip())
angles = []
for i in range(n):
	angles.append(int(sys.stdin.readline().strip()))
angles_reached = {0: 1}
for angle in angles:
	new_reached = {}
	for (angle1, flag) in angles_reached.items():
		new_reached[(angle1 + angle) % 360] = 1
		new_reached[(angle1 - angle) % 360] = 1
	angles_reached = new_reached
if 0 in angles_reached:
	print('YES')
else:
	print('NO')


n = int(input())
arr = [0]
for _ in range(n):
	i = int(input())
	new = []
	for o in arr:
		new.append(o + i)
		new.append(o - i)
	arr = new[:]
if any((c % 360 == 0 for c in arr)):
	print('YES')
else:
	print('NO')


n = int(input())
all = []
for i in range(0, n):
	tmp = int(input())
	all.append(tmp)

def dfs(cur, ang):
	if cur == n:
		return ang % 360 == 0
	return dfs(cur + 1, ang + all[cur]) or dfs(cur + 1, ang - all[cur])
if dfs(0, 0):
	print('YES')
else:
	print('NO')


n = int(input())
a = []
sum = 0
for i in range(n):
	a.append(int(input()))
for i in range(1 << n):
	s = 0
	for j in range(n):
		if i & 1 << j:
			s += a[j]
		else:
			s -= a[j]
	if s % 360 == 0:
		exit(print('YES'))
print('NO')


n = int(input())
s = 1
arr = [0]
for i in range(n):
	inp = int(input())
	new = []
	for o in arr:
		new.extend([o + inp, o - inp])
	arr = new
for c in arr:
	if c % 360 == 0:
		s = 2
		print('YES')
		break
if s == 1:
	print('NO')


n = int(input())
l = [0]
ind = 0
c = 1
for i in range(n):
	ang = int(input())
	for j in l[ind:]:
		l.append(j + ang)
		l.append(j - ang)
		c += 2
		ind += 1
for i in range(c - 1, ind - 1, -1):
	if l[i] % 360 == 0:
		print('yes')
		break
else:
	print('no')


while True:
	try:

		def check(com, n, a):
			s1 = s2 = 0
			for i in range(n):
				if com & 1 << i:
					s1 += a[i]
				else:
					s2 += a[i]
			if (s1 - s2) % 360 == 0:
				return True
			if (s1 + s2) % 360 == 0:
				return True
			return False

		def soln(n, a):
			yes = False
			for i in range(0, 1 << n):
				if check(i, n, a):
					yes = True
				if yes:
					break
			if yes:
				print('YES')
			else:
				print('NO')

		def read():
			n = int(input())
			a = []
			for i in range(n):
				a.append(int(input()))
			soln(n, a)
		if __name__ == '__main__':
			read()
	except EOFError:
		break


l1 = [0]
l2 = []
for _ in range(int(input())):
	i = int(input())
	for item in l1:
		l2.append(item + i)
		l2.append(item - i)
	l1 = l2
	l2 = []
ans = 'NO'
for item in l1:
	if item % 360 == 0:
		ans = 'YES'
		break
print(ans)


n = int(input())
comparisons = [0]
for i in range(n):
	num = int(input())
	l = []
	for j in comparisons:
		l.append(j - num)
		l.append(j + num)
	comparisons = l
ans = 'NO'
for item in comparisons:
	if item % 360 == 0 or item == 0:
		ans = 'YES'
		break
print(ans)


N = int(input())
l = [None] * N
for i in range(N):
	l[i] = int(input())
ans = 'No'
mask = 0
while mask < 1 << N:
	sum_deg = 0
	for i in range(N):
		if mask & 1 << i:
			sum_deg += l[i]
		else:
			sum_deg -= l[i]
	if sum_deg % 360 == 0:
		ans = 'Yes'
		break
	mask += 1
print(ans)


n = int(input())
A = [int(input()) for i in range(n)]
N = [0]
for a in A:
	l = []
	for n in N:
		l.append((n + a) % 360)
		l.append((n - a) % 360)
	N = list(set(l))
if 0 in N:
	print('YES')
else:
	print('NO')


def GetAllCombs(n):
	combs = []
	for i in range(2 ** n):
		b = bin(i)
		b = b[2:]
		if len(b) < n:
			b = '0' * (n - len(b)) + b
		combs.append(b)
	return combs

def IsPossible(rotations):
	n = len(rotations)
	all_combs = GetAllCombs(n)
	for comb in all_combs:
		s = 0
		for i in range(n):
			if comb[i] == '1':
				s += rotations[i]
			else:
				s -= rotations[i]
		if s % 360 == 0:
			return True
	return False

def main():
	n = int(input())
	rotations = []
	for i in range(n):
		rotations.append(int(input()))
	rotations.sort()
	if IsPossible(rotations):
		print('YES')
	else:
		print('NO')
main()


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
s = []
t = len(bin(n))
for i in range(2 ** n):
	s.append((n - len(bin(i)[2:])) * '0' + bin(i)[2:])
for i in range(2 ** n):
	sum1 = 0
	for j in range(n):
		if s[i][j] == '0':
			sum1 = sum1 + l[j]
		else:
			sum1 = sum1 - l[j]
	if sum1 == 0 or sum1 % 360 == 0:
		print('YES')
		exit()
print('NO')


from math import sqrt, gcd

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

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())
n = ii()
a = []
for i in range(n):
	a.append(ii())
for i in range(2 ** n):
	sum = 0
	b = bin(i)
	b = b[2:]
	x = n - len(b)
	b = list(b)
	b = [0] * x + b
	for j in range(n):
		if b[j] == '0':
			sum += a[j]
		else:
			sum -= a[j]
	if sum % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
n_list = []
for item in range(n):
	n_list.append(int(input()))

def pov(i, summa):
	if i == len(n_list):
		if abs(summa) % 360 == 0:
			return 'Yes'
		else:
			return 'NO'
	if pov(i + 1, summa + n_list[i]) == 'Yes':
		return 'Yes'
	elif pov(i + 1, summa - n_list[i]) == 'Yes':
		return 'Yes'
	else:
		return 'No'
print(pov(0, 0))


def dpa(n):
	dp = [[False for i in range(360)] for j in range(n + 1)]
	for i in range(n + 1):
		for j in range(360):
			if i == 0:
				if j == 0:
					dp[i][j] = True
				else:
					dp[i][j] = False
			else:
				dp[i][j] = dp[i - 1][(j + a[i - 1]) % 360] or dp[i - 1][(j - a[i - 1]) % 360]
	return dp[n][0]
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
ans = dpa(n)
if ans:
	print('YES')
else:
	print('NO')


def check(pos):
	global n, a, arr, ans
	if ans:
		if pos >= n:
			summ = 0
			for i in range(n):
				summ += a[i] * arr[i]
			if summ % 360 == 0:
				print('YES')
				ans = False
		else:
			for y in range(2):
				x = 1
				if y < 1:
					x = -1
				a[pos] = x
				check(pos + 1)
n = int(input())
a = [0] * n
ans = True
arr = []
for i in range(n):
	x = int(input())
	arr.append(x)
check(0)
if ans:
	print('NO')


n = int(input())
arr = [int(input()) for i in range(n)]

def func(arr, i=0, k=0):
	if i == len(arr):
		if k % 360 == 0:
			return True
		else:
			return False
	x = func(arr, i + 1, k + arr[i])
	y = func(arr, i + 1, k - arr[i])
	return x or y
print('YES' if func(arr) else 'NO')


def function(count):
	summ = 0
	for i in range(len(count)):
		if count[i] == '1':
			summ -= list[i]
		if count[i] == '0':
			summ += list[i]
	return summ

def to_string(count):
	count = count[2:]
	if len(count) < number:
		count = '0' * (number - len(count)) + count
	return count
number = int(input())
list = []
for i in range(number):
	list.append(int(input()))
minimum = 9999999
count = '0b0'
board = to_string(count)
while len(board) == number:
	minimum = abs(function(board))
	if minimum % 360 == 0:
		print('YES')
		exit(0)
	count = bin(int(count, 2) + 1)
	board = to_string(count)
print('NO')


def perms(n):
	l = []
	if not n:
		return
	for i in range(2 ** n):
		s = bin(i)[2:]
		s = '0' * (n - len(s)) + s
		l.append(s)
	return l
n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
a = perms(n)
for i in range(len(a)):
	sum = 0
	for j in range(n):
		if a[i][j] == '1':
			sum += l[j]
		else:
			sum -= l[j]
	if sum % 360 == 0:
		print('YES')
		break
	elif i == len(a) - 1:
		print('NO')


import sys
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))

def fun(s, k):
	global a, n
	if k == n:
		if s == 0 or s % 360 == 0:
			print('YES')
			sys.exit(0)
	else:
		fun(s + a[k], k + 1)
		fun(s - a[k], k + 1)
fun(a[0], 1)
print('NO')


def dvoich(X):
	S = ''
	while X != 0:
		S = str(X % 2) + S
		X //= 2
	return S
N = int(input())
x = 0
while not len(dvoich(2 ** x)) <= N < len(dvoich(2 ** (x + 1))):
	x += 1
X = []
for i in range(N):
	X += [int(input())]
check = 0
for i in range(2 ** x, 2 ** (x + 1)):
	s = 0
	k = dvoich(i)
	for j in range(len(k)):
		if k[j] == '0':
			s -= X[j]
		else:
			s += X[j]
	if abs(s) % 360 == 0:
		print('YES')
		check = 1
		break
if check == 0:
	print('NO')


def clk(li, d, sum1):
	global p, ans, n
	while d < n:
		sum1 += li[d]
		if d == n - 1 and sum1 % 360 == 0:
			p += 1
			ans.append('YES')
			return True
		d += 1
		clk(li, d, sum1)
		aclk(li, d, sum1)
	if d == n:
		return 0

def aclk(li, d, sum1):
	global p, ans, n
	while d < n:
		sum1 -= li[d]
		if d == n - 1 and sum1 % 360 == 0:
			p += 1
			ans.append('YES')
			return
		d += 1
		clk(li, d, sum1)
		aclk(li, d, sum1)
	if d == n:
		return 0
n = int(input())
li = []
ans = []
for x in range(n):
	li.append(int(input()))
d = 0
sum1 = p = 0
a = clk(li, d, sum1)
if p == 0:
	b = aclk(li, d, sum1)
if p == 0:
	print('NO')
else:
	set(ans)
	print(ans[0])


def fun(i, s):
	global n
	if i == n:
		if abs(s) % 360 == 0:
			return True
		return False
	return fun(i + 1, s + a[i]) or fun(i + 1, s - a[i])
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
if fun(0, 0):
	print('YES')
else:
	print('NO')


from itertools import repeat
n = int(input())
a = [int(input()) for _ in repeat(None, n)]

def check(c, i):
	if i == n:
		return c % 360 == 0
	return check(c + a[i], i + 1) or check(c - a[i], i + 1)
print('YES' if check(0, 0) else 'NO')


n = int(input())
a = []
for i in range(n):
	x = int(input())
	a.append(x)
x = [i for i in range(2 ** n)]
x = [bin(i) for i in x]
x = [i[2:] for i in x]
x = [i.zfill(n) for i in x]
for i in x:
	s = 0
	for j in range(n):
		if i[j] == '1':
			s += a[j]
		else:
			s -= a[j]
	s %= 360
	if s == 0:
		print('YES')
		import sys
		sys.exit(0)
print('NO')


n = int(input())
l = [0]
for i in range(n):
	temp = []
	a = int(input())
	for e in l:
		temp.extend([e + a, e - a])
	l = temp
for i in l:
	if i % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
f = 0
a = [int(input()) for i in range(n)]
for i in range(1 << n):
	t = 0
	for j in range(n):
		if i & 1 << j:
			t += a[j]
		else:
			t -= a[j]
	if t % 360 == 0:
		print('YES')
		exit()
print('NO')


I = lambda : int(input())
n = I()
A = [I() for _ in range(n)]
for i in range(2 ** n):
	s = bin(i)[2:].zfill(n)
	if sum((A[j] if s[j] == '1' else -A[j] for j in range(n))) % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
degs = [int(input()) for _ in range(n)]

def helper(cur, i):
	if i == n:
		if cur % 360 == 0:
			return True
		return False
	ok1 = helper(cur + degs[i], i + 1)
	ok2 = helper(cur - degs[i], i + 1)
	return ok1 or ok2
ok = helper(0, 0)
if ok:
	print('YES')
else:
	print('NO')


def find(a):
	n = 0
	s = ''
	while len(s) < a + 2:
		n += 1
		s = bin(n)
	return n
n = int(input())
A = []
for i in range(n):
	A.append(int(input()))
l_bound = find(n)
u_bound = find(n + 1)
for b in range(l_bound, u_bound + 1):
	S = 0
	num = bin(b)[2:]
	for s in range(n):
		if num[s] == '1':
			S += A[s]
		else:
			S -= A[s]
	if S % 360 == 0:
		print('YES')
		break
else:
	print('NO')


from typing import List

def solv(arr: List[int]) -> bool:
	reachable = [0] * 360
	new_reachable = [0] * 360
	sliced = arr[1:]
	reachable[arr[0] % 360] = 1
	for (k, v) in enumerate(sliced):
		for i in range(360):
			if reachable[i] == 1:
				new_reachable[(i + v) % 360] = 1
				new_reachable[abs(i - v) % 360] = 1
		(reachable, new_reachable) = (new_reachable, reachable)
		for i in range(len(new_reachable)):
			new_reachable[i] = 0
		if k == len(sliced) - 2:
			reachable[0] = 0
	return reachable[0] == 1
TESTS = int(input())
arr = [0] * TESTS
for i in range(TESTS):
	arr[i] = int(input())
print('YES' if solv(arr) else 'NO')


import itertools, math
n = int(input())
x = []
for i in range(n):
	x.append(int(input()))
b = n * '0'
g = pow(2, n)
h = '1' + n * '0'
while b != '1' + n * '0':
	(sum, j) = (0, 0)
	for i in b:
		if i == '1':
			sum += x[j]
		else:
			sum -= x[j]
		j += 1
	if sum % 360 == 0:
		print('YES')
		exit()
	b = bin(int(b, 2) + 1)[2:].zfill(n)
print('NO')


n = int(input())
a = []
for i in range(n):
	x = int(input())
	a.append(x)
for i in range(1, 2 ** n):
	ans = 0
	for j in range(n):
		if i & 1 << j:
			ans += a[j]
	ans = ans * 2 - sum(a)
	if ans % 360 == 0:
		print('YES')
		exit()
print('NO')


k = []
l = []
n = int(input())
for _ in range(n):
	l.append(int(input()))
for i in range(1, 2 ** n):
	x = bin(i)
	x = x[2:]
	p = ''
	for j in range(len(x), n):
		p += '0'
	p += x
	k.append(p)
flag = 'NO'
for i in range(len(k)):
	tot = 0
	for j in range(len(k[i]) - 1, -1, -1):
		if k[i][j] == '1':
			tot += l[j]
			tot %= 360
		else:
			tot -= l[j]
			if tot < 0:
				tot += 360
	if tot == 0:
		flag = 'YES'
		break
print(flag)


def GSB(x):
	counter = 0
	while x != 0:
		counter += 1
		x = x >> 1
	return counter - 1
N = int(input())
rotations = []
for i in range(N):
	rotations.append(int(input()))
combinations = [int(x) for x in range(2 ** N)]
for i in combinations:
	checker = [x for x in rotations]
	j = 0
	z = GSB(i)
	while j != z and i != 0:
		if i & 1 == 1:
			checker[j] *= -1
		i = i >> 1
		j += 1
	if sum(checker) % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
ans = False
for i in range(1 << n):
	sum_ = 0
	for j in range(n):
		if i & 1 << j > 0:
			sum_ += a[j]
		else:
			sum_ -= a[j]
	if sum_ % 360 == 0:
		ans = True
if ans:
	print('YES')
else:
	print('NO')


SetX = [[0]]
for i in range(int(input())):
	N = int(input())
	Temp = []
	for j in SetX[-1]:
		Temp.append((j + N) % 360)
		if j - N >= 0:
			Temp.append(j - N)
		else:
			Temp.append(360 + (j - N))
	SetX.append(Temp)
print('YES' if 0 in SetX[-1] else 'NO')


from itertools import product
n = int(input())
s = []
for i in range(n):
	s_i = input()
	s.append(int(s_i))
l = [1, -1]
nn = list(product(l, repeat=n))
flag = 0
sum = 0
for n in nn:
	for i in range(len(n)):
		sum += s[i] * n[i]
	if sum % 360 == 0:
		sum = 0
		flag += 1
		break
	else:
		sum = 0
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	l = int(input())
	a.append(l)
sum = [a[0], -a[0]]
for i in range(1, n):
	v = []
	for t in sum:
		v.append((t + a[i]) % 360)
		v.append((t - a[i]) % 360)
	v = list(set(v))
	sum = v[0:len(v):1]
if 0 in sum:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	t = int(input())
	a += [t]
flag = False

def result(pos, ind):
	global flag
	if ind < n:
		result((pos + a[ind]) % 360, ind + 1)
		result((pos - a[ind]) % 360, ind + 1)
	elif pos == 0:
		flag = True
result(0, 0)
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
arr = [0]
for i in range(n):
	a = int(input())
	lt1 = [a] * 2 ** i
	lt2 = [-1 * a] * 2 ** i
	arr = [a + b for (a, b) in zip(arr, lt1)] + [a + b for (a, b) in zip(arr, lt2)]
bool = True
for j in arr:
	if j % 360 == 0:
		bool = False
		print('YES')
		break
if bool:
	print('NO')


n = int(input())
lst1 = []
for i in range(n):
	lst1.append(int(input()))

def ways(i, sum1):
	if i >= n:
		if sum1 % 360 == 0:
			return True
		else:
			return False
	else:
		a = ways(i + 1, sum1 - lst1[i])
		b = ways(i + 1, sum1 + lst1[i])
		return a or b
if ways(0, 0) == True:
	print('YES')
else:
	print('NO')


import math
n = input()
numbers = []
for i in range(int(n)):
	numbers.append(int(input()))
fakedp = {0}
for i in numbers:
	lazy = []
	removelazy = []
	for f in fakedp:
		removelazy.append(int(f))
		lazy.append(int(f) + int(i))
		lazy.append(int(f) - int(i))
	for k in removelazy:
		fakedp.remove(int(k))
	for e in lazy:
		fakedp.add(e)
flag = False
for e in fakedp:
	if e % 360 == 0 and (not flag):
		print('YES')
		flag = True
if not flag:
	print('NO')


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	a = [int(input()) for _ in range(n)]
	poss = [0]
	for i in range(n):
		breadth = []
		while poss:
			x = poss.pop(0)
			breadth.append((x - a[i]) % 360)
			breadth.append((x + a[i]) % 360)
		poss = breadth
	print('YES' if 0 in poss else 'NO')
main()


n = int(input())
angles = [int(input()) for _ in range(n)]

def solve(summ, index):
	if index == n:
		return summ % 360
	x = solve(summ + angles[index], index + 1)
	y = solve(summ - angles[index], index + 1)
	return 0 if x == 0 or y == 0 else 1
if solve(0, 0) == 0:
	print('YES')
else:
	print('NO')


from __future__ import print_function
from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
from math import *
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
mod = 360
(n,) = gil()
stack = [0]

def normalize(j):
	if stack[j] < 0:
		stack[j] += mod
	elif stack[j] >= mod:
		stack[j] %= mod
for _ in range(n):
	(v,) = gil()
	for j in range(len(stack)):
		stack.append(stack[j] + v)
		stack[j] -= v
		normalize(-1)
		normalize(j)
print('YES' if 0 in stack else 'NO')


def rec(ost, s=0, start=0):
	if start == len(ost):
		if s % 360 == 0:
			return True
		return False
	if rec(ost, s=s + ost[start], start=start + 1):
		return True
	return rec(ost, s=s - ost[start], start=start + 1)
amount = int(input())
spis = [int(input()) for i in range(amount)]
if rec(spis):
	print('Yes')
else:
	print('No')


def dfs(x, s):
	if x == n:
		return 1 if s % 360 == 0 else 0
	return dfs(x + 1, s + a[x + 1]) if dfs(x + 1, s + a[x + 1]) == 1 else dfs(x + 1, s - a[x + 1])
n = int(input())
a = [0]
i = 0
while i < n:
	c = int(input())
	a.append(c)
	i += 1
if dfs(0, 0) == 1:
	print('YES\n')
else:
	print('NO\n')


n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
for j in range(2 ** n):
	bin_j = bin(j)
	bit_j = '0' * (n - len(bin_j[2:])) + bin_j[2:]
	sum1 = 0
	for (ind, elem) in enumerate(bit_j):
		if elem == '0':
			sum1 += arr[ind]
		else:
			sum1 -= arr[ind]
	if sum1 % 360 == 0:
		print('YES')
		exit()
		break
print('NO')


n = int(input())
ss = [0]
for _ in range(0, n):
	s1 = []
	nn = int(input())
	for i in ss:
		s1 += [(i - nn) % 360] + [(i + nn) % 360]
	ss = list(set(s1))
if 0 in ss:
	print('YES')
else:
	print('NO')


import sys
import collections
import math
import functools
import itertools
import bisect
import operator
import heapq
import random
true = True
false = False
null = None
SLOW = True
memoi = functools.lru_cache(None)
tcid = 0
tcmax = 99999999

def fast():
	SLOW = False

def compute(val, func):
	return func(val)

def seq(lo, hi, step=1):
	return range(lo, hi + 1, step)

def sround(val, nd):
	return f'{val:.{nd}f}'

def ceil(a, b):
	ans = a // b
	if a % b != 0:
		ans += 1
	return ans

def e1e(d, e):
	return d * 10 ** e
mod = e1e(1, 9) + 7

class arrays(list):

	def __init__(self, defval, *sizes):
		self.sizes = sizes
		self.dimension = len(sizes)
		self.pm = pm = list(sizes)
		pm.append(1)
		for ii in reversed(range(self.dimension)):
			pm[ii] *= pm[ii + 1]
		list.__init__(self, itertools.repeat(defval, pm[0]))

	def ___i1d___(self, ixs):
		if not isinstance(ixs, tuple):
			return ixs
		if len(ixs) != self.dimension:
			raise LookupError(f'Dimension must be {self.dimension}.')
		ans = 0
		for ii in range(self.dimension):
			ix = ixs[ii]
			if ix >= self.sizes[ii]:
				raise IndexError(f'Index[{ii}]={ix} >= Len[{ii}]={self.sizes[ii]}.')
			ans += ix * self.pm[ii + 1]
		return ans

	def __getitem__(self, ixs):
		ixs = self.___i1d___(ixs)
		return list.__getitem__(self, ixs)

	def __setitem__(self, ixs, val):
		ixs = self.___i1d___(ixs)
		list.__setitem__(self, ixs, val)

	def jagged(self, dim0, ofs):
		if dim0 + 1 == self.dimension:
			return self[ofs:ofs + self.sizes[dim0]]
		ans = []
		for ii in range(self.sizes[dim0]):
			ans.append(self.jagged(dim0 + 1, ofs))
			ofs += self.pm[dim0 + 1]
		return ans

	def __str__(self):
		return str(self.jagged(0, 0))

def perr(*args, **kwargs):
	if SLOW:
		print(*args, file=sys.stderr, **kwargs)

def line():
	ln = sys.stdin.readline().strip()
	if ln == '':
		sys.exit()
	return ln

def lines(n):
	return [line() for i in range(n)]

def split(ln=None):
	return (ln or line()).split()

def num(str=None):
	str = str or line()
	return float(str) if '.' in str else int(str)

def nums(o=None):
	if o is not None:
		if isinstance(o, int):
			o = lines(o)
		elif isinstance(o, str):
			o = split(o)
	return list(map(num, o or split()))

def mainloop(tcid=1):
	n = num()
	a = nums(n)

	@memoi
	def aaa(ii, dd):
		dd = (dd + 360) % 360
		if ii == n:
			return int(dd == 0)
		return aaa(ii + 1, dd + a[ii]) + aaa(ii + 1, dd - a[ii])
	ans = aaa(0, 0)
	ans = min(ans, 1)
	ans = ['NO', 'YES'][ans]
	print(ans)
while tcid < tcmax:
	tcid += 1
	mainloop(tcid)


n = int(input())
a = []
b = []
for i in range(n):
	tmp = int(input())
	a.append(tmp)
	b.append(tmp)
flag = 0
for i in range(pow(2, n - 1)):
	for j in range(n):
		if i >> j & 1:
			b[j] = -a[j]
		else:
			b[j] = a[j]
	ans = sum(b) % 360
	if ans == 0:
		flag = 1
if flag == 1:
	print('YES')
else:
	print('NO')


import itertools
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
if sum(a) % 360 == 0:
	print('YES')
	exit(0)
for c in itertools.product([1, -1], repeat=n):
	s = 0
	for i in range(n):
		s += c[i] * a[i]
	if s % 360 == 0:
		print('YES')
		exit(0)
print('NO')


import sys
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
for i in range(2 ** n):
	m = bin(i)[2:]
	r = n - len(m)
	m = '0' * r + m
	sumc = 0
	for i in range(n):
		if m[i] == '0':
			sumc -= a[i]
		else:
			sumc += a[i]
	if abs(sumc) % 360 == 0:
		print('YES')
		sys.exit()
print('NO')


n = int(input())
m = [int(input()) for _ in range(n)]
t = [0]
tmp = []
for i in m:
	tmp.clear()
	for (j, e) in enumerate(t):
		tmp.append(e + i)
		tmp.append(e - i)
	t = tmp.copy()
flag = 0
for i in t:
	if i % 360 == 0:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


def simple_recurse(index, sum):
	if index < 0:
		return 1
	if index == 0:
		if (sum + r_list[index]) % 360 == 0 or (sum - r_list[index]) % 360 == 0:
			return 0
		else:
			return 1
	return min(simple_recurse(index - 1, (sum + r_list[index]) % 360), simple_recurse(index - 1, (sum - r_list[index]) % 360))
n = int(input())
r_list = [int(input()) for x in range(0, n)]
res = simple_recurse(n - 1, 0)
if res == 0:
	print('YES')
else:
	print('NO')


def solve(l, x):
	n = len(l)
	s = bin(x)
	try:
		s = s[s.index('1'):]
		s = '0' * (n - len(s)) + s
	except:
		s = '0' * n
	sm = 0
	for (i, ch) in enumerate(s):
		if ch == '0':
			sm += l[i]
		else:
			sm -= l[i]
	return sm % 360
n = int(input())
lst = [int(input()) for i in range(n)]
r = 2 ** (n - 1)
yes = False
for i in range(r):
	if solve(lst, i) == 0:
		yes = True
		break
if yes:
	print('YES')
else:
	print('NO')


import sys
a = []
sum = 0
height = int(input())
s = int(input())
sum += s
a.append(s)
a.append(s * -1)
for _ in range(height - 1):
	inp = int(input())
	sum += inp
	temp = []
	for i in a:
		temp.append(i + inp)
		temp.append(i - inp)
	a = temp[:]
if 0 in a:
	print('YES')
else:
	for i in a:
		if i % 360 == 0:
			print('YES')
			sys.exit()
	print('NO')


def fun(n, lst2):
	for i in range(len(lst2)):
		lst2.append(lst2[i] + n)
		lst2.append(lst2[i] - n)
n = int(input())
lst1 = []
for i in range(n):
	a = int(input())
	lst1.append(a)
lst2 = [lst1[0]]
lst1.pop(0)
while len(lst1) != 0:
	fun(lst1[0], lst2)
	lst1.pop(0)
k = 0
lstfinal = []
for i in range(2 ** (n - 1)):
	lstfinal.append(lst2.pop())
for i in lstfinal:
	if i % 360 == 0 or i == 0:
		print('YES')
		k = 1
		break
if k == 0:
	print('NO')


n = int(input())
arr = [0]
for _ in range(n):
	inp = int(input())
	new = []
	for o in arr:
		new.extend([o + inp, o - inp])
	arr = new[:]
print('YES' if any((c % 360 == 0 for c in arr)) else 'NO')


import sys
n = int(input())
a = [int(input()) for i in range(n)]
for mask in range(0, 2 ** n):
	s = 0
	for i in range(n):
		bit = mask >> i & 1
		if bit:
			s += a[i]
		else:
			s -= a[i]
	if s % 360 == 0:
		print('YES')
		sys.exit(0)
print('NO')


n = int(input())
nums = [int(input()) for _ in range(n)]

def calc(m, num, i):
	if m == n:
		return not num % 360
	else:
		return calc(m + 1, num + nums[i], i + 1) or calc(m + 1, num - nums[i], i + 1)
if calc(0, 0, 0):
	print('YES')
else:
	print('NO')


arr = [0]
t = int(input())
while t:
	t -= 1
	n = int(input())
	lst = []
	for i in arr:
		lst.append(n + i)
		lst.append(n - i)
	arr = lst
for i in arr:
	if i % 360 == 0:
		print('YES')
		break
else:
	print('NO')


def gen(i, angle):
	if i == n:
		return angle % 360 == 0
	return gen(i + 1, angle + a[i]) or gen(i + 1, angle - a[i])
n = int(input())
a = [int(input()) for _ in range(n)]
print('YES' if gen(0, 0) else 'NO')


t = int(input())
arr = []
for _ in range(t):
	arr.append(int(input()))

def go(cur, i):
	if i >= t:
		cur = cur % 360
		if cur == 0:
			return 1
		else:
			return 0
	ans = go(cur + arr[i], i + 1) or go(cur - arr[i], i + 1)
	return ans
if go(0, 0):
	print('YES')
else:
	print('NO')


from collections import deque
import heapq
import bisect
import math

def main():
	n = int(input())
	a = [int(input()) for i in range(n)]
	for i in range(1 << n):
		cur = 0
		for j in range(n):
			if i >> j & 1:
				cur += a[j]
			else:
				cur -= a[j]
		if cur % 360 == 0:
			print('YES')
			exit()
	print('NO')
main()


n = int(input())
a = list()
ok = 0
for i in range(n):
	a.append(int(input()))
for v in range(1 << n):
	sum = 0
	for i in range(n):
		if (1 << i & v) >> i == 1:
			sum += a[i]
		else:
			sum -= a[i]
	if sum % 360 == 0:
		ok = 1
		break
print(ok == 1 and 'YES' or 'NO')


n = int(input())
l = []
for _ in range(n):
	l.append(int(input()))

def recurse(x, i):
	if i < 0 and x % 360 == 0:
		return True
	if i < 0:
		return False
	return recurse(x - l[i], i - 1) or recurse(x + l[i], i - 1)
print('YES' if recurse(0, n - 1) else 'NO')


n = int(input())
l = []
for i in range(0, n):
	a = int(input())
	if not l:
		l.append(a)
	else:
		l2 = []
		for x in l:
			l2.append(x + a)
			l2.append(x - a)
		l = l2
str = 'NO'
for x in l:
	if x % 360 == 0:
		str = 'YES'
		break
print(str)


from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
n = int(input())
A = [int(input()) for i in range(n)]

def dfs(i, d):
	if i == n:
		return d % 360 == 0
	return any((dfs(i + 1, d + A[i]), dfs(i + 1, d - A[i])))
print('YES' if dfs(0, 0) else 'NO')


def rec(a, n, s):
	if n == 0 and s % 360 == 0:
		return True
	elif n == 0 and s % 360 != 0:
		return False
	else:
		return rec(a, n - 1, s - a[n - 1]) or rec(a, n - 1, s + a[n - 1])
n = int(input())
a = []
k = n
while k > 0:
	k -= 1
	x = int(input())
	a.append(x)
s = sum(a)
if s % 2 != 0:
	print('NO')
elif s % 360 == 0:
	print('YES')
else:
	ans = rec(a, n, 0)
	if ans == True:
		print('YES')
	else:
		print('NO')


n = int(input())
op = []
s = 0
for i in range(n):
	op.append(int(input()))
for i in range(0, 2 ** (n + 1)):
	x = bin(i)[2:]
	x = '0' * (n - len(x)) + x
	for j in range(n):
		if x[j] == '1':
			s += op[j]
		else:
			s -= op[j]
	if s % 360 == 0:
		print('YES')
		break
	s = 0
	if 2 ** n == i:
		print('NO')


R = lambda : map(int, input().split())
dp = [-1] * 360
dp[0] = 0
n = int(input())
for t in range(1, n + 1):
	x = int(input())
	dpc = dp[:]
	for i in range(len(dp)):
		if dp[i] == t - 1:
			dpc[(i + x) % 360] = t
			dpc[(360 + i - x) % 360] = t
	dp = dpc
print('YES' if dp[0] == n else 'NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
flag = False
for i in range(0, 1 << n):
	sum = 0
	num = 1 << n - 1
	for j in range(0, n):
		if i & num > 0:
			sum += l[j]
		else:
			sum += -1 * l[j]
		num = num >> 1
	if sum % 360 == 0:
		print('YES')
		flag = True
		break
if flag == False:
	print('NO')


n = int(input())
x = int(input())
a = [abs(x), -abs(x)]
for i in range(n - 1):
	x = int(input())
	b = [(d + x) % 360 for d in a]
	c = [(d - x) % 360 for d in a]
	a = b + c
if 0 in a:
	print('YES')
else:
	print('NO')


def yes_no(n):
	a = [[0 for j in range(2 ** i)] for i in range(n)]
	a[0][0] = int(input())
	for i in range(1, n):
		key = int(input())
		for j in range(0, 2 ** i, 2):
			a[i][j] = a[i - 1][j // 2 + j % 2] + key
			a[i][j + 1] = a[i - 1][j // 2 + j % 2] - key
	for i in a[-1]:
		if i == 0 or i % 360 == 0:
			print('YES')
			break
	else:
		print('NO')
n = int(input())
yes_no(n)


t = int(input())
inp = []
tempo = t
flag = 0
while t > 0:
	temp = int(input())
	inp.append(temp)
	t -= 1
for i in range(2 ** tempo):
	num = i
	temp = []
	for j in range(tempo):
		temp.append(num % 2)
		num = num // 2
	sum = 0
	for j in range(tempo):
		if temp[j] == 0:
			sum -= inp[j]
		else:
			sum += inp[j]
	if sum % 360 == 0:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


def testa(nAtual, idx):
	horario = nAtual + angulos[idx]
	antiHorario = nAtual - angulos[idx]
	idx += 1
	if (horario == 0 or antiHorario == 0 or (horario >= 360 and horario % 360 == 0) or (antiHorario >= 360 and antiHorario % 360 == 0)) and idx == len(angulos):
		return True
	if idx == len(angulos):
		return False
	if testa(horario, idx):
		return True
	if testa(antiHorario, idx):
		return True
	return False
n = int(input())
angulos = []
for rotation in range(n):
	angulos.append(int(input()))
listaAdj = [[] for e in range(n)]
if testa(0, 0):
	print('YES')
else:
	print('NO')


def main():
	numSpins = int(input())
	values = []
	for i in range(numSpins):
		values.append(int(input()))
	possibleValues = []
	possibleValues.append(values[0])
	possibleValues.append(-values[0])
	for i in range(numSpins - 1):
		temp = []
		for value in possibleValues:
			temp.append(value + values[i + 1])
			temp.append(value - values[i + 1])
		possibleValues = []
		for value in temp:
			possibleValues.append(value)
	flag = False
	for value in possibleValues:
		if value % 360 == 0:
			flag = True
	if flag:
		print('YES')
	else:
		print('NO')
main()


a = [0]
for _ in range(int(input())):
	b = int(input())
	t = []
	for k in a:
		t.append(k - b)
		t.append(k + b)
	a = t
for i in a:
	if i == 0 or i % 360 == 0:
		print('YES')
		break
else:
	print('NO')


def decimal_to_binary(number, n):
	bin_representation_to_str = str(bin(number)[2:])
	if len(bin_representation_to_str) != n:
		new_representation = ''
		for i in range(abs(n - len(bin_representation_to_str))):
			new_representation += '0'
		return [1 if i == '1' else -1 for i in new_representation + bin_representation_to_str]
	else:
		return [1 if i == '1' else -1 for i in bin_representation_to_str]

def dot_product(v1, v2):
	dot_product = 0
	for (i, j) in zip(v1, v2):
		dot_product += i * j
	return dot_product
n = int(input())
angles = [int(input()) for _ in range(n)]
flag = False
for i in range(2 ** n):
	if dot_product(decimal_to_binary(i, n), angles) == 0 or dot_product(decimal_to_binary(i, n), angles) % 360 == 0:
		print('YES')
		flag = True
		break
if not flag:
	print('NO')


def solve(x, current):
	if x >= n:
		return 0 if current != 0 else 1
	if solve(x + 1, (current + a[x]) % 360):
		return 1
	elif solve(x + 1, (current - a[x]) % 360):
		return 1
	else:
		return 0
n = int(input())
a = [int(input()) for i in range(n)]
print(['NO', 'YES'][solve(0, 0)])


def calc(numbers):

	def _calc(numbers, result, index):
		if index < len(numbers):
			r1 = _calc(numbers, result + numbers[index], index + 1)
			r2 = _calc(numbers, result - numbers[index], index + 1)
			return r1 or r2
		elif index == len(numbers):
			return result % 360 == 0
	return _calc(numbers, 0, 0)
n = int(input())
numbers = []
for _ in range(n):
	number = int(input())
	numbers.append(number)
print('YES' if calc(numbers) else 'NO')


t = int(input())
a = []
sum = 0
flag = 0
for q in range(t):
	p = int(input())
	a.append(p)
	sum += p
for i in range(1, 2 ** t):
	j = 0
	temp = sum
	while i > 0:
		if i & 1 == 1:
			temp -= 2 * a[j]
		j += 1
		i = i >> 1
	if abs(temp) % 360 == 0:
		flag = 1
		print('YES')
		break
if flag == 0:
	print('NO')


a = int(input())
x = [int(input()) for i in range(a)]
for i in range(1 << a):
	w = 0
	for j in range(a):
		if i >> j & 1:
			w += x[j]
		else:
			w -= x[j]
	if w % 360 == 0:
		print('yes')
		exit(0)
print('no')


import sys, os
import math
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
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
flg = False
for i in range(1 << n):
	ans = 0
	for j in range(n):
		if i & 1 << j:
			ans += arr[j]
			ans %= 360
		else:
			ans -= arr[j]
			ans %= 360
	if ans % 360 == 0:
		flg = True
		break
print('YES' if flg else 'NO')


n = int(input())
a = [int(input()) for x in range(0, n)]
for x in range(0, 2 ** n + 1):
	v = 0
	for p in range(0, n):
		if x >> p & 1 != 0:
			v += a[p]
		else:
			v -= a[p]
	if v % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
combs = [0]
new_c = []
for _ in range(n):
	i = int(input())
	for e in combs:
		new_c.append(e + i)
		new_c.append(e - i)
	combs = new_c
	new_c = []
ans = 'NO'
for e in combs:
	if e % 360 == 0:
		ans = 'YES'
		break
print(ans)


from itertools import product
N = int(input())
A = [int(input()) for i in range(N)]
for P in product([0, 1], repeat=N):
	d = 0
	for (a, p) in zip(A, P):
		if p:
			d += a
		else:
			d -= a
	if d % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = [0]
for i in range(n):
	m = int(input())
	l = []
	for num in a:
		l.append(num + m)
		l.append(num - m)
	a = l
for i in a:
	if i % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
a = [0]
for i in range(n):
	ai = int(input())
	a = list(map(lambda x: (x + ai) % 360, a)) + list(map(lambda x: (x - ai) % 360, a))
if 0 in a:
	print('YES')
else:
	print('NO')


N = int(input())
L = []
for _ in range(N):
	L.append(int(input()))
for i in range(1 << N):
	k = 0
	for j in range(N):
		if i & 1 << j:
			k += L[j]
		else:
			k -= L[j]
	if k % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
list = []
sum = [0]
c = 0
while n > 0:
	n -= 1
	a = int(input())
	for i in range(len(sum)):
		sum.append(sum[i] - a)
		sum[i] += a
for i in range(len(sum)):
	if sum[i] % 360 == 0:
		c = 1
		break
if c == 1:
	print('YES')
else:
	print('NO')


n = eval(input())
a = []
for i in range(n):
	a.append(eval(input()))
check = False
for i in range(2 ** n):
	clockwise = []
	anticlockwise = []
	binary = '{0:b}'.format(i)
	for i in range(len(binary)):
		if binary[i] == '1':
			clockwise.append(i)
	for i in range(n):
		if i not in clockwise:
			anticlockwise.append(i)
	deg = 0
	for i in range(n):
		if i in clockwise:
			deg += a[i]
		else:
			deg -= a[i]
	if deg % 360 == 0:
		check = True
		break
if check:
	print('YES')
else:
	print('NO')


def main():
	uu = [True] + [False] * 359
	for _ in range(int(input())):
		(a, vv) = (int(input()), [False] * 360)
		for (b, f) in enumerate(uu):
			if f:
				vv[b + a - 360] = vv[b - a] = True
		uu = vv
	print(('NO', 'YES')[uu[0]])
main()


def degreee(n, s, sumi, ans):
	if n == len(s):
		if sumi == 0 or sumi % 360 == 0:
			return True
		else:
			return False
	if ans is not True:
		cloclWise = degreee(n + 1, s, sumi + s[n], ans)
	if ans is not True:
		anticlock = degreee(n + 1, s, sumi - s[n], ans)
	ans = cloclWise or anticlock
	return ans
a = int(input())
l = []
for i in range(a):
	l.append(int(input()))
if degreee(0, l, 0, False):
	print('Yes')
else:
	print('No')


import math
import bisect
import itertools
import sys
I = lambda : sys.stdin.readline()
mod = 10 ** 9 + 7

def mindiff(a):
	b = a[:]
	b.sort()
	m = 10000000000
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] < m:
			m = b[i + 1] - b[i]
	return m

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

def merge(a, b):
	i = 0
	j = 0
	c = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] < b[j]:
			ans.append(a[i])
			i += 1
		else:
			ans.append(b[j])
			c += len(a) - i
			j += 1
	ans += a[i:]
	ans += b[j:]
	return (ans, c)

def mergesort(a):
	if len(a) == 1:
		return (a, 0)
	mid = len(a) // 2
	(left, left_inversion) = mergesort(a[:mid])
	(right, right_inversion) = mergesort(a[mid:])
	(m, c) = merge(left, right)
	c += left_inversion + right_inversion
	return (m, c)

def is_prime(num):
	if num == 1:
		return False
	if num == 2:
		return True
	if num == 3:
		return True
	if num % 2 == 0:
		return False
	if num % 3 == 0:
		return False
	t = 5
	a = 2
	while t <= int(math.sqrt(num)):
		if num % t == 0:
			return False
		t += a
		a = 6 - a
	return True

def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def binsearch(arr, b, low, high):
	if low == high:
		return low
	if arr[math.ceil((low + high) / 2)] < b:
		return binsearch(arr, b, low, math.ceil((low + high) / 2) - 1)
	else:
		return binsearch(arr, b, math.ceil((low + high) / 2), high)

def ncr1(n, r):
	s = 1
	for i in range(min(n - r, r)):
		s *= n - i
		s %= mod
		s *= pow(i + 1, mod - 2, mod)
		s %= mod
	return s

def calc(n, m, r):
	s = 0
	for i in range(0, r + 1, 2):
		s += ncr1(n, i) * ncr1(m, i)
		s %= mod
	return s
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
if sum(a) % 360 == 0:
	print('YES')
else:
	for i in range(0, 2 ** n):
		s = bin(i)[2:]
		s = (n - len(s)) * '0' + s
		ans = 0
		for j in range(len(s)):
			if s[j] == '1':
				ans += a[j]
			else:
				ans -= a[j]
		if ans % 360 == 0:
			exit(print('YES'))
	print('NO')


n = int(input())
can = []
can1 = []
can.append(0)
for i in range(n):
	x = int(input())
	for j in can:
		can1.append((j + x) % 360)
		can1.append((j - x + 360) % 360)
	can = can1[:]
	can1.clear()
if 0 in can:
	print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline
n = int(input())
x = int(input())
a = [abs(x), -abs(x)]
for i in range(n - 1):
	x = int(input())
	b = [(d + x) % 360 for d in a]
	c = [(d - x) % 360 for d in a]
	a = b + c
print(['NO', 'YES'][0 in a])


def combinations(A, mass, len_A):
	flag = 0
	while A > 0:
		summa = 0
		A = bin(A)[2:]
		l = len(A)
		A = '0' * (len_A - l) + A
		for i in range(len_A):
			if A[i] == '1':
				summa -= mass[i]
			if A[i] == '0':
				summa += mass[i]
		A = int(str(A), 2)
		A -= 1
		if summa % 360 == 0:
			print('YES')
			flag = 1
			break
	if flag == 0:
		print('NO')
	return
n = int(input())
mass = []
for i in range(n):
	mass += [int(input())]
len_A = n
n = 2 ** n - 1
combinations(n, mass, len_A)


def rec(i, summ):
	global mass
	global checker
	if i == len(mass) - 1:
		if (summ + mass[i]) % 360 == 0 or (summ - mass[i]) % 360 == 0:
			checker = True
	else:
		rec(i + 1, summ + mass[i])
		rec(i + 1, summ - mass[i])
n = int(input())
mass = []
checker = False
for i in range(n):
	mass.append(int(input()))
rec(0, 0)
if checker:
	print('YES')
else:
	print('NO')


n = int(input())
l = n * [0]
y = 2 ** n * [0]
for i in range(n):
	q = int(input())
	for j in range(2 ** n):
		if (j + 1) // 2 ** i % 2 == 0:
			y[j] += q
		else:
			y[j] -= q
t = 0
for k in y:
	if k % 360 == 0:
		print('YES')
		t = 1
		break
if t == 0:
	print('NO')


def sum_0(lis, index, size, sum_):
	if index == size - 1:
		if (sum_ + lis[index]) % 360 == 0 or (sum_ - lis[index]) % 360 == 0 or sum_ + lis[index] == 0 or (sum_ - lis[index] == 0):
			return True
		else:
			return False
	else:
		return sum_0(lis, index + 1, size, sum_ + lis[index]) or sum_0(lis, index + 1, size, sum_ - lis[index])
n = int(input())
lis = []
for _ in range(n):
	num = int(input())
	lis.append(num)
if sum_0(lis, 0, n, 0):
	print('YES')
else:
	print('NO')


full = int(input())
arr = []
for _ in range(full):
	arr.append(int(input()))

def dfs(sum, step):
	if step == full:
		if sum % 360 == 0:
			return True
		else:
			return False
	elif dfs(sum + arr[step], step + 1) == False and dfs(sum - arr[step], step + 1) == False:
		return False
	else:
		return True
print('YES' if dfs(0, 0) else 'NO')


def solve(arr, n):
	mx = 3000
	for set_b in range(1, 1 << n):
		bn = bin(set_b)[2:]
		bn = bn.zfill(n)
		sm = 0
		for (pos, it) in enumerate(bn):
			if it == '1':
				sm += arr[pos]
			else:
				sm -= arr[pos]
		if sm % 360 == 0:
			print('YES')
			return
	print('NO')
n = int(input())
arr = []
for i in range(n):
	t = int(input())
	arr.append(t)
solve(arr, n)


def f(cou, s):
	if cou == n:
		if s % 360 == 0:
			print('YES')
			exit(0)
	else:
		f(cou + 1, s + a[cou])
		f(cou + 1, s - a[cou])
n = int(input())
a = list()
for i in range(n):
	a.append(int(input()))
f(0, 0)
print('NO')


import itertools
n = int(input())
turns = []
for i in range(n):
	turns.append(int(input()))
ans = 'NO'
for config in itertools.product([-1, 1], repeat=n):
	sum_ = 0
	for i in range(n):
		sum_ += config[i] * turns[i]
	if sum_ % 360 == 0:
		ans = 'YES'
print(ans)


n = int(input())
a = [int(input()) for i in range(n)]
for mask in range(2 ** n):
	ans = 0
	cmask = mask
	for i in range(n):
		ans = ans + (a[i] if cmask % 2 == 1 else -a[i])
		cmask = cmask // 2
	if ans % 360 == 0:
		print('YES')
		exit(0)
print('NO')


n = int(input())
a = [int(input()) for i in range(n)]
for i in range(2 ** n):
	s = ''
	k = i
	for j in range(n):
		s = str(k % 2) + s
		k //= 2
	x = 0
	for j in range(n):
		if s[j] == '0':
			x -= a[j]
		else:
			x += a[j]
	if x % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
li = []
for _ in range(n):
	li.append(int(input()))
res = 0
for y in range(pow(2, n)):
	check_string = bin(y)[2:].zfill(n)
	sum = 0
	for x in range(n):
		if check_string[x] == '0':
			sum -= li[x]
		elif check_string[x] == '1':
			sum += li[x]
	if sum % 360 == 0:
		res = 1
		break
if res == 0:
	print('NO')
else:
	print('YES')


n = int(input())
ls = []
p = 0
for i in range(n):
	ls.append(int(input()))
if sum(ls) % 360 == 0:
	print('YES')
else:
	for i in range(0, 2 ** n):
		b = bin(i)[2:]
		b = (n - len(b)) * '0' + b
		op = 0
		for j in range(len(b)):
			if b[j] == '0':
				op = op - ls[j]
			else:
				op = op + ls[j]
		if op % 360 == 0:
			exit(print('YES'))
	print('NO')


import sys
from itertools import *
a = list(map(int, sys.stdin.readlines()[1:]))
B = product([1, -1], repeat=len(a))
for b in B:
	q = 0
	for (x, y) in zip(a, b):
		q += x * y
		q = q % 360
	if q == 0:
		print('YES')
		sys.exit(0)
print('NO')


def d2b(k):
	a = [0] * n
	r = 0
	i = -1
	while k >= 2:
		r = k % 2
		k = k // 2
		a[i] = r
		i -= 1
	a[i] = k
	return a
n = int(input())
m = []
for i in range(2 ** n):
	m.append(d2b(i))
b = []
for i in range(n):
	b.append(int(input()))
for i in range(len(m)):
	a = 0
	for j in range(n):
		if m[i][j] == 0:
			a += b[j]
		else:
			a -= b[j]
	if a % 360 == 0:
		print('YES')
		break
else:
	print('NO')


def f(i, a):
	if i == n:
		return a % 360 == 0
	return f(i + 1, a + L[i]) or f(i + 1, a - L[i])
n = int(input())
L = [int(input()) for i in range(n)]
if f(0, 0):
	print('YES')
else:
	print('NO')


def norm(n):
	return (n + 360) % 360
n = int(input())
clock = []
for i in range(n):
	clock.append(int(input()))
dp = [[-1 for _ in range(1 << i + 1)] for i in range(n)]
dp[0][0] = norm(clock[0])
dp[0][1] = norm(-clock[0])
ans = False
for i in range(1, n):
	for j in range(1 << i + 1):
		dp[i][j] = norm(dp[i - 1][j >> 1] + pow(-1, j - (j >> 1)) * clock[i])
		if i == n - 1 and dp[i][j] == 0:
			ans = True
print('YES' if ans else 'NO')


from sys import stdin

def solve(l, i, n, k):
	if i == n:
		if (k - l[i]) % 360 == 0 or (k + l[i]) % 360 == 0:
			return 0
		else:
			return 1
	return min(solve(l, i + 1, n, k + l[i]), solve(l, i + 1, n, k - l[i]))
n = int(stdin.readline().rstrip())
l = []
p = n
while n > 0:
	l.append(int(stdin.readline().rstrip()))
	n -= 1
if solve(l, 0, p - 1, 0) == 0:
	print('YES')
else:
	print('NO')


from sys import stdin
from bisect import bisect_right
inp = lambda : stdin.readline().strip()

def int2bin(integer, digits):
	if integer >= 0:
		return bin(integer)[2:].zfill(digits)
	else:
		return bin(2 ** digits + integer)[2:]
n = int(inp())
a = []
for i in range(n):
	a.append(int(inp()))
for i in range(2 ** n):
	curr = 0
	for (k, j) in enumerate(int2bin(i, n)):
		j = int(j)
		if j == 0:
			curr += a[k]
		else:
			curr -= a[k]
	if curr % 360 == 0:
		print('YES')
		break
else:
	print('NO')


from math import *
from copy import *
from string import *
from sys import stdin
from itertools import *
from collections import Counter

def solve(n, x, i, l):
	if x >= 360:
		x -= 360
	elif x <= -360:
		x += 360
	if i == n:
		if x == 0:
			return True
		else:
			return False
	f1 = solve(n, x + l[i], i + 1, l)
	f2 = solve(n, x - l[i], i + 1, l)
	if f1 or f2:
		return True
	else:
		return False
L = []
T = int(input())
for _ in range(T):
	N = int(stdin.readline())
	L.append(N)
f = solve(T, 0, 0, L)
if f:
	print('YES')
else:
	print('NO')


n = int(input())
a = [0] * 16
for _ in range(n):
	a[_] = int(input())

def f(n):
	l = [bin(x)[2:].rjust(n, '0') for x in range(2 ** n)]
	for _ in l:
		s = 0
		for i in range(0, n):
			s += a[i] if _[i] == '1' else -a[i]
		if s % 360 == 0:
			print('YES')
			exit()
f(n)
print('NO')


n = int(input())
aas = []
for i in range(n):
	aas.append(int(input()))
aas.sort()
sm = sum(aas)
fd = False
for i in range(1 << n):
	ss = []
	for j in range(n):
		if i & 1 << j:
			ss.append(aas[j])
	if sm - 2 * sum(ss) == 0 or (sm - 2 * sum(ss)) % 360 == 0:
		fd = True
		break
if fd:
	print('YES')
else:
	print('NO')


import math
alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
a = []
d = [0] * (n + 1)
for i in range(n):
	a.append(int(input()))
E = sum(a)
while d[-1] != 1:
	if E % 360 == 0:
		print('YES')
		break
	else:
		d[0] += 1
		for i in range(n):
			if d[i] > 1:
				E += 2 * a[i]
				d[i + 1] += 1
				d[i] = 0
			else:
				E -= 2 * a[i]
				break
else:
	print('NO')


n = int(input())
a = []
for i in range(0, n):
	now = int(input())
	a.append(now)
ok = 0
for i in range(0, 1 << n):
	tot = 0
	for j in range(0, n):
		if i >> j & 1 == 1:
			tot = (tot + a[j]) % 360
		else:
			tot = (tot + 360 - a[j]) % 360
	if tot == 0:
		ok = 1
if ok == 1:
	print('YES')
else:
	print('NO')


N = int(input())
arr = []
for i in range(N):
	arr.append(int(input()))
sum = 0
ok = False
for i in range(1 << N):
	sum = 0
	for j in range(N):
		if (i >> j) % 2:
			sum += arr[j]
		else:
			sum -= arr[j]
	if sum % 360 == 0:
		ok = True
		break
print('YES' if ok else 'NO')


import sys
import math

def read_int():
	return int(input().strip())

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

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

def read_string_list(delim=' '):
	return input().strip().split(delim)

def check(a, i):
	if sum(a) % 360 == 0:
		print('YES')
		sys.exit()
	if i == len(a):
		return
	check(a, i + 1)
	a[i] = 360 - a[i]
	check(a, i + 1)
n = read_int()
arr = []
for i in range(n):
	arr.append(read_int())
check(arr, 0)
print('NO')


n = int(input(''))
A = [-1] * 20
K = [[]] * 20
for i in range(0, n):
	A[i + 1] = int(input(''))
K[1] = [A[1]]
for i in range(2, n + 1):
	new_array = []
	for o in K[i - 1]:
		new_array.append(abs(o + A[i]))
		new_array.append(abs(o - A[i]))
	K[i] = list(set(new_array))
answer = 'NO'
for res in K[n]:
	if res % 360 == 0:
		answer = 'YES'
		break
print(answer)


n = int(input())
nums = []
for i in range(n):
	nums.append(int(input()))

def check(nums):
	vals = [False] * 360
	vals[0] = True
	for n in nums:
		new_vals = [False] * 360
		for v in range(360):
			if vals[v]:
				new_vals[(v + n + 360) % 360] = True
				new_vals[(v + 360 - n) % 360] = True
		vals = new_vals
	return vals[0]
ans = 'YES' if check(nums) else 'NO'
print(ans)


n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
import itertools as it
if sum(a) % 2:
	print('NO')
else:
	f = False
	q = it.product([-1, 1], repeat=n)
	for i in q:
		s = 0
		for j in range(len(i)):
			s += i[j] * a[j]
		if s % 360 == 0:
			f = True
			break
	if f:
		print('YES')
	else:
		print('NO')


from itertools import combinations

def solve(items, summation):
	l = []
	for length in range(1, len(items)):
		for subset in combinations(items, length):
			l.append(sum(subset))
			if sum(subset) == summation or sum(subset) - 360 in l or sum(subset) - 720 in l:
				boole = 1
				return boole
x = int(input())
l1 = []
l2 = []
boole = 0
for i in range(x):
	s = int(input())
	l1.append(s)
l1.sort()
total = sum(l1)
if total % 2 == 0 and total != 2700 and (total != 180):
	if total % 360 == 0:
		boole = 1
	else:
		boole = solve(l1, total / 2)
if boole == 1:
	print('YES')
else:
	print('NO')


Y = lambda : int(input())
n = Y()
ans = [0]
for i in range(n):
	x = []
	y = Y()
	for b in ans:
		x.append(b + y)
	for b in ans:
		x.append(b - y)
	ans = x[:]
for i in ans:
	if i % 360 == 0:
		exit(print('YES'))
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
for i in range(1 << n):
	cpI = i
	ans = 0
	for j in range(n):
		if cpI % 2 == 1:
			ans += a[j]
		else:
			ans -= a[j]
		cpI //= 2
	if ans % 360 == 0:
		print('YES')
		break
else:
	print('NO')


n = int(input())
rotations = []
for i in range(n):
	rotations.append(int(input()))
answer = 'NO'
for i in range(2 ** n):
	binary = '{0:015b}'.format(i)
	angle = 0
	for j in range(14, 14 - n, -1):
		angle += (1 if binary[j] == '1' else -1) * rotations[14 - j]
	if angle % 360 == 0:
		answer = 'YES'
		break
print(answer)


n = int(input())
turns = []
for i in range(n):
	turns.append(int(input()))

def check(i):
	tot = 0
	bn = format(i, f'0{n}b')
	for x in range(n):
		if bn[x] == '1':
			tot += turns[x]
		else:
			tot -= turns[x]
	if tot % 360 == 0:
		return True
	else:
		return False
result = 'NO'
for i in range(1, 2 ** n):
	if check(i):
		result = 'YES'
		break
print(result)


N = int(input())
X = [0]
for i in range(N):
	a = int(input())
	Y = []
	for x in X:
		Y.append((x + a) % 360)
		Y.append((x - a) % 360)
	X = Y
X = sorted(X)
if X[0] == 0:
	print('YES')
else:
	print('NO')


def func():
	n = int(input())
	a = tuple((int(input()) for i in range(n)))
	for i in range(1, 1 << n):
		x = bin(i)[2:]
		x = '0' * (n - len(x)) + x
		s = 0
		for j in range(n):
			if x[j] == '1':
				s += a[j]
			else:
				s -= a[j]
		if s % 360 == 0:
			print('YES')
			return None
	print('NO')
func()


n = int(input())
k = []
for i in range(n):
	k.append(int(input()))
k = sorted(k)

def f(s, i):
	if s % 360 == 0 and i == n:
		print('YES')
		exit()
	if i == n:
		return
	f(s + k[i], i + 1)
	f(s - k[i], i + 1)
f(0, 0)
print('NO')


n = int(input())
a = []
b = []
for i in range(n):
	k = int(input())
	a.append(k)
	b.append(0)
p = []

def pr(l, b, p):
	sum = 0
	for i in range(l):
		sum += b[i] * a[i]
	p.append(sum % 360)

def recur(l, b, s=0):
	if s == l:
		pr(l, b, p)
	else:
		b[s] = 1
		recur(l, b, s + 1)
		b[s] = -1
		recur(l, b, s + 1)
recur(n, b)
if 0 in p:
	print('YES')
else:
	print('NO')


n = int(input())
cs = []
for i in range(n):
	cs.append(int(input()))
ok = False
for mask in range(2 ** n):
	count = 0
	for x in range(n):
		if mask >> x & 1:
			count += cs[x]
		else:
			count -= cs[x]
	if count % 360 == 0:
		ok = True
		break
if ok:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	a = int(input())
	dp = [a, 360 - a]
	for i in range(n - 1):
		a = int(input())
		np = []
		for i in dp:
			np.append((i + a) % 360)
			np.append((i - a) % 360)
		dp[:] = np[:]
	if min(dp) == 0:
		print('YES')
	else:
		print('NO')
main()


num_n = int(input())
arr = []
for i in range(num_n):
	arr.append(int(input()))
total_mv = len(arr)
memo = [[-1 for _ in range(total_mv)] for _ in range(360)]

def rec(deg, num_mv):
	if num_mv == total_mv:
		return deg == 0
	if memo[deg][num_mv] != -1:
		return memo[deg][num_mv]
	s1 = rec((deg + arr[num_mv]) % 360, num_mv + 1)
	s2 = rec((deg - arr[num_mv]) % 360, num_mv + 1)
	ans = max(s1, s2)
	memo[deg][num_mv] = ans
	return memo[deg][num_mv]
if rec(0, 0):
	print('YES')
else:
	print('NO')


def suma_o_resta(a, b):
	return a & 1 << b

def has_lock(v, n):
	suma = 0
	for x in range(1 << n):
		for i in range(n):
			if suma_o_resta(x, i) > 0:
				suma += v[i]
			else:
				suma += -1 * v[i]
		if suma % 360 == 0:
			return 'YES'
		suma = 0
	return 'NO'
rotations = int(input())
v = []
for i in range(rotations):
	v.append(int(input()))
print(has_lock(v, rotations))


n = int(input())
a = []
ans = []

def s(aa, ans, i, smm):
	if i == n:
		ans.append(smm)
	else:
		smm += aa[i]
		s(aa, ans, i + 1, smm)
		smm -= aa[i]
		s(aa, ans, i + 1, smm)
for i in range(n):
	a.append(int(input()))
sm = sum(a)
if sm % 2:
	print('NO')
else:
	s(a, ans, 0, 0)
	flag = 0
	for i in ans:
		if abs(sm - 2 * i) % 360 == 0:
			flag = 1
			break
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
s = []
for i in range(n):
	s.append(int(input()))
ts = sum(s)
c = 0
if ts % 360 == 0:
	c = 1
else:
	ls = []
	for i in range(1, 2 ** n):
		te = i
		su = 0
		j = 0
		while te != 0:
			if te % 2 == 1:
				su += s[j]
			te = te // 2
			j += 1
		if su != 0:
			ls.append(su)
	for i in ls:
		if (ts - 2 * i) % 360 == 0:
			c = 1
			break
if c == 0:
	print('NO')
else:
	print('YES')


import sys
import copy
input = sys.stdin.readline
n = int(input())
a = []
for i in range(n):
	x = int(input())
	a.append(x)
for j in range(0, (1 << n) + 1):
	s = bin(j)[2:]
	if len(s) <= n:
		s = '0' * (n - len(s)) + s
	else:
		break
	rr = 0
	for i in range(len(s)):
		if s[i] == '1':
			rr += a[i]
		else:
			rr -= a[i]
	if rr % 360 == 0:
		print('YES')
		exit(0)
print('NO')


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
n = int(z())
l = [0]
for _ in range(n):
	b = []
	x = int(z())
	for j in l:
		b.append((j + x) % 360)
		b.append((j - x) % 360)
	l = list(set(b))
if 0 in l:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
for k in range(2 ** n):
	s = bin(k)[2:].zfill(n)
	ang = 0
	for i in range(n):
		if s[i] == '1':
			ang += a[i]
		else:
			ang -= a[i]
	if ang % 360 == 0:
		print('YES')
		exit()
print('NO')


n = int(input())
l = [0]
for _ in range(0, n):
	a = int(input())
	l2 = []
	for x in l:
		l2.append(x + a)
		l2.append(x - a)
	l = l2
print(('NO', 'YES')[any([x % 360 == 0 for x in l])])


n = int(input())
moves = []
for i in range(n):
	moves.append(int(input()))

def solve(x, ex):
	if x >= n:
		if ex % 360 == 0:
			return True
		else:
			return False
	else:
		a1 = solve(x + 1, ex - moves[x])
		if a1:
			return True
		a2 = solve(x + 1, ex + moves[x])
		if a2:
			return True
		return False
ans = solve(0, 0)
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
a = [0]
for i in range(n):
	st = []
	t = int(input())
	for i in a:
		st.append(i + t)
		st.append(i - t)
	a = st
r = False
for i in a:
	if (i % 360 + 360) % 360 == 0:
		r = True
print('YES' if r else 'NO')


import sys

def f(i, s):
	if i == n:
		if s % 360 == 0:
			print('YES')
			sys.exit()
		return
	f(i + 1, s + b[i])
	f(i + 1, s - b[i])
n = int(input())
b = []
for i in range(n):
	b.append(int(input()))
f(0, 0)
print('NO')


turns = int(input())
turn_list = []
for i in range(turns):
	turn_list.append(int(input()))

def lock(n, lst, pos):
	if n == 0 and pos == 0:
		return True
	elif n == 0:
		return False
	return lock(n - 1, lst[:n - 1], (pos + lst[n - 1]) % 360) or lock(n - 1, lst[:n - 1], (pos - lst[n - 1]) % 360)
if lock(turns, turn_list, 0):
	print('YES')
else:
	print('NO')


def req(curr, i):
	if i == len(ls) - 1:
		if (curr + ls[-1]) % 360 == 0 or (curr - ls[-1]) % 360 == 0:
			print('YES')
			raise SystemExit()
	else:
		req(curr + ls[i], i + 1)
		req(curr - ls[i], i + 1)
ls = []
for _ in range(int(input())):
	ls.append(int(input()))
req(0, 0)
print('NO')


import itertools
n = int(input())
flag = 1
lst = [list(i) for i in itertools.product([0, 1], repeat=n)]
angles = []
for i in range(n):
	angles.append(int(input()))
for i in lst:
	s = 0
	for j in range(n):
		if i[j] == 0:
			s -= angles[j]
		else:
			s += angles[j]
	if s == 0 or s % 360 == 0:
		flag = 0
		break
if flag == 1:
	print('no')
else:
	print('yes')


def correct(arr):
	if sum(arr) % 360 == 0:
		return 1
	else:
		return 0

def allcom(arr):
	nn = len(arr)
	for j in range(2 ** nn):
		a_copy = arr[:]
		for i in range(nn):
			if j & 2 ** i:
				a_copy[i] = -a_copy[i]
		if correct(a_copy):
			ans.append(1)
n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
ans = []
allcom(arr)
if 1 in ans:
	print('YES')
else:
	print('NO')


n = int(input())
turns = [int(input()) for i in range(n)]

def main():
	for i in range(int('1' * n, 2) + 1):
		status = '{0:0{1}b}'.format(i, n)
		value = 0
		for j in range(n):
			if status[j] == '0':
				value += turns[j]
			else:
				value -= turns[j]
		if value % 360 == 0:
			return True
	return False
answer = main()
if answer:
	print('YES')
else:
	print('NO')


import copy
t = int(input())
arr = []
for i in range(t):
	arr.append(int(input()))
add = [0]
dif = [0]
for i in range(t):
	for j in range(len(add)):
		add[j] = add[j] + arr[i]
	for j in range(len(dif)):
		dif[j] = dif[j] - arr[i]
		add.append(dif[j])
	dif = []
	for j in range(len(add)):
		dif.append(add[j])
ok = False
for i in dif:
	if i % 360 == 0:
		ok = True
if ok:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
flag = True
for i in range(2 ** n):
	s = '0000000000000000' + str(bin(i)[2:])
	su = 0
	for l in range(n):
		if s[-n + l] == '0':
			su += a[l]
		else:
			su -= a[l]
	if su % 360 == 0:
		print('YES')
		flag = False
		break
if flag:
	print('NO')


n = int(input())
ar = [0]
for i in range(n):
	new = []
	a = int(input())
	for j in ar:
		new.append(j + a)
		new.append(j - a)
	ar = new[:]
for m in ar:
	if m % 360 == 0:
		t = 1
		break
	else:
		t = 0
if t == 1:
	print('YES')
else:
	print('NO')


sum = 0
a = []
n = int(input())
for i in range(n):
	a.append(int(input()))
exp = 2 ** len(a)
set = 0
for i in range(exp):
	flag = i
	sum = 0
	for j in range(len(a)):
		y = flag & 1
		if y == 0:
			sum = sum - a[j]
		else:
			sum = sum + a[j]
		flag = flag >> 1
	if sum % 360 == 0:
		set = 1
		break
if set == 1:
	print('YES')
else:
	print('NO')


arr = []

def dfs(deg, idx, lvl):
	if lvl == 0:
		return deg % 360 == 0
	return dfs(deg - arr[idx], idx + 1, lvl - 1) or dfs(deg + arr[idx], idx + 1, lvl - 1)
n = int(input())
for i in range(n):
	x = int(input())
	arr.append(x)
if dfs(0, 0, n):
	print('YES')
else:
	print('NO')


flag = True
n = int(input())
a = []
for i in range(n):
	inp = int(input())
	a.append(inp)
m = 1
for m in range(1, 1 << n, 2):
	pos = 0
	for i in range(n):
		if m >> i & 1 == 1:
			pos += a[i] * 1
		else:
			pos += a[i] * -1
		if pos < 0:
			pos = 360 - pos
		elif pos > 359:
			pos -= 360
	if pos == 0:
		print('YES')
		flag = False
		break
if flag:
	print('NO')


(MAX_N, MAX_DEG) = (15, 360)
mem = [[-1] * (1 + MAX_DEG) for _ in range(1 + MAX_N)]

def solve(i, deg):
	if mem[i][deg] != -1:
		return mem[i][deg]
	if i == n:
		if deg == 0:
			return True
		else:
			return False
	mem[i][deg] = solve(i + 1, (deg + d[i]) % 360) or solve(i + 1, (deg - d[i]) % 360)
	return mem[i][deg]
n = int(input())
d = []
for _ in range(n):
	d.append(int(input()))
if solve(0, 0):
	print('YES')
else:
	print('NO')


n = int(input())
a = [0]
for i in range(n):
	new = []
	ang = int(input())
	for j in a:
		new.append(j + ang)
		new.append(j - ang)
		a = new[:]
print('YES' if any((ang % 360 == 0 for ang in a)) else 'NO')


import collections

def checking(de, n, sum):
	if n == 0:
		if sum == 0 or sum % 360 == 0:
			return True
		else:
			return False
	else:
		temp = de[-1]
		de.pop()
		if checking(de, len(de), sum + temp) == True:
			return True
		if checking(de, len(de), sum - temp) == True:
			return True
		de.appendleft(temp)
	return False

def checking_helper(de):
	return checking(de, len(de), sum=0)
de = collections.deque()
n = int(input())
for i in range(0, n):
	temp = int(input())
	de.append(temp)
if checking_helper(de) == True:
	print('Yes', end='')
else:
	print('No', end='')


n = int(input())
lis = [int(input())]
res = []
for _ in range(n - 1):
	t = int(input())
	for i in range(len(lis)):
		res.append(lis[i] - t)
		res.append(lis[i] + t)
	lis = res
	res = []
check = 'NO'
for i in lis:
	if i % 360 == 0:
		check = 'YES'
		break
print(check)


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
for i in range(1 << n):
	lol = 0
	for j in range(n):
		if 1 << j & i:
			lol += a[j]
		else:
			lol -= a[j]
	if lol % 360 == 0:
		print('YES')
		break
else:
	print('NO')


import functools

def rotate(A):
	n = len(A)

	@functools.lru_cache(None)
	def helper(idx, degrees):
		if idx == n:
			return abs(degrees) % 360 == 0
		return helper(idx + 1, degrees + A[idx]) or helper(idx + 1, degrees - A[idx])
	if not helper(0, 0):
		print('NO')
	else:
		print('YES')
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
rotate(A)


rotNumb = int(input())
rotList = []
resList = []
for i in range(rotNumb):
	rotList.append(int(input()))
resList.append(rotList[0])
for i in range(1, rotNumb):
	for j in range(len(resList)):
		resList[j] -= rotList[i]
		resList.append(resList[j] + 2 * rotList[i])
for i in resList:
	if i % 360 == 0 or i == 0:
		print('YES')
		exit(0)
print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
out = []
for i in range(0, 2 ** n):
	k = bin(i)[2:]
	need = n - len(k)
	out.append('0' * need + k)
flag = False
for i in out:
	ans = 0
	count = 0
	for j in i:
		if j == '0':
			ans += l[count]
		else:
			ans -= l[count]
		count += 1
	if ans % 360 == 0:
		print('YES')
		flag = True
		break
if flag == False:
	print('NO')


n = int(input())
a = [0] * n
l = [0] * pow(2, n)
for i in range(n):
	a[i] = int(input())
	l[0] -= a[i]
l[1] = l[0] + 2 * a[0]
count = 2
if l[0] == 0 or abs(l[0]) == 360 or l[1] == 0 or (abs(l[1]) == 360):
	print('YES')
else:
	k = 1
	flag = False
	while k < n:
		leng = 0
		while leng < 2 ** k:
			l[count] = l[leng] + 2 * a[k]
			if abs(l[count]) % 360 == 0:
				print('YES')
				flag = True
				break
			count += 1
			leng += 1
		if flag == True:
			break
		k += 1
	if flag == False:
		print('NO')


b = [0]
for _ in range(int(input())):
	p = int(input())
	l = len(b)
	for _ in range(l):
		x = b.pop(0)
		b.append((x + p) % 360)
		b.append(abs(x - p) % 360)
if 0 in b:
	print('YES')
else:
	print('NO')


import sys
n = int(sys.stdin.readline().strip())
A = [-10] * 360
B = [-10] * 360
A[0] = -1
for i in range(0, n):
	a = int(sys.stdin.readline().strip())
	for j in range(0, 360):
		if A[j] == i - 1:
			B[(j + a) % 360] = i
			B[(j - a) % 360] = i
	A = B[:]
if A[0] == n - 1:
	print('YES')
else:
	print('NO')


def solve(x, n, L):
	s = 0
	for i in range(n):
		if 1 << i & x == 0:
			s += L[i]
		else:
			s -= L[i]
	if s % 360 == 0:
		return True
	return False
n = int(input())
L = [0] * n
for i in range(n):
	L[i] = int(input())
for i in range(2 ** n):
	if solve(i, n, L):
		print('YES')
		exit()
print('NO')


n = int(input())
a = []
flag = False
for i in range(n):
	a.append(int(input()))
for i in range(0, 2 ** n):
	k = 2 ** (n + 1) + i
	k = bin(k)
	s = 0
	for i in range(n):
		if k[len(k) - 1 - i] == '0':
			s += a[i]
		else:
			s -= a[i]
	if s % 360 == 0:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


def dfs(lis, i, sum, n):
	if i == n:
		return sum % 360 == 0
	return dfs(lis, i + 1, sum + lis[i], n) | dfs(lis, i + 1, sum - lis[i], n)
n = int(input())
l = []
m = n
while n:
	l.append(int(input()))
	n = n - 1
s = dfs(l, 0, 0, m)
if s == True:
	print('YES')
else:
	print('NO')


n = int(input())
dp = [0] * pow(2, n + 1)
angles = [int(input()) for i in range(n)]
for i in range(pow(2, n + 1)):
	if i % 2 == 0:
		dp[i] = dp[i // 2] - angles[len(bin(i)) - 4]
	else:
		dp[i] = dp[i // 2] + angles[len(bin(i)) - 4]
flag = 'NO'
for i in range(pow(2, n), pow(2, n + 1)):
	if dp[i] % 360 == 0:
		flag = 'YES'
print(flag)


from itertools import product
p = '+-'
n = int(input())
l1 = []
for i in range(n):
	l1.append(int(input()))
r = 'NO'
for i in product(p, repeat=n):
	a = ''.join(i)
	t = 0
	for j in range(len(a)):
		if a[j] == '+':
			t += l1[j]
		else:
			t -= l1[j]
	if t % 360 == 0:
		r = 'YES'
		break
print(r)


from itertools import *
n = int(input())
if n == 1:
	print('NO')
	exit(0)
a = []
s = 0
for i in range(n):
	a.append(int(input()))
	s += a[i]
if s % 360 == 0:
	print('YES')
	exit(0)
ans = False
for i in range(1, n + 1):
	for c in combinations(a, i):
		if sum(c) % 360 == (s - sum(c)) % 360:
			ans = True
			break
	if ans:
		break
print('YES') if ans else print('NO')


n = int(input())
a = [0] * n
for i in range(n):
	a[i] = int(input())
ans = 'NO'
for i in range(1 << n):
	degree = 0
	for j in range(n):
		if i & 1 << j > 0:
			degree = (degree - a[j] + 360) % 360
		else:
			degree = (degree + a[j]) % 360
	if degree == 0:
		ans = 'YES'
		break
print(ans)


from sys import stdin, stdout
n = int(stdin.readline().strip())
ang = []
for i in range(n):
	ang.append(int(stdin.readline().strip()))
flag = False
for i in range(1 << n, 1 << n + 1):
	tans = 0
	for j in range(n):
		if i & 1 << j == 0:
			tans -= ang[j]
		else:
			tans += ang[j]
		tans = tans % 360
	if tans == 0:
		flag = True
		break
if flag == True:
	print('YES')
else:
	print('NO')


n = int(input())
k = [0]
for _ in range(n):
	b = int(input())
	z = len(k)
	ch = []
	for j in range(z):
		ch.append(k[j] - b)
		ch.append(k[j] + b)
	k = ch[:]
print(sum([1 for i in k if i % 360 == 0]) > 1 and 'Yes' or 'No')


import sys
import math
from itertools import combinations

def main():
	n = int(input())
	ar = [int(input()) for _ in range(n)]
	found = False
	for mask in range(0, 1 << n):
		s = 0
		for i in range(n):
			if mask & 1 << i:
				s += ar[i]
			else:
				s -= ar[i]
		s %= 360
		s = (s + 360) % 360
		if s == 0:
			found = True
	print('YES' if found else 'NO')
main()


N = int(input())
A = []
a = True
for b in range(N):
	A.append(int(input()))

def abc(i, sum):
	if i != N:
		abc(i + 1, sum + A[i])
		abc(i + 1, sum - A[i])
	elif sum % 360 == 0:
		global a
		a = False
		return
abc(0, 0)
if not a:
	print('YES')
else:
	print('NO')


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

def it():
	return int(input())
n = it()
l = []
for i in range(n):
	l.append(it())
s = []
t = len(bin(n))
for i in range(2 ** n):
	s.append((n - len(bin(i)[2:])) * '0' + bin(i)[2:])
for i in range(len(s)):
	ans = 0
	for j in range(n):
		if s[i][j] == '0':
			ans += l[j]
		else:
			ans -= l[j]
	if ans % 360 == 0:
		print('YES')
		exit()
print('NO')


def possiblwWays(arr, n, k, total):
	if k == n:
		if total % 360 == 0:
			return 1
		else:
			return 0
	op1 = possiblwWays(arr, n, k + 1, total + arr[k])
	op2 = possiblwWays(arr, n, k + 1, total - arr[k])
	return op1 | op2
n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
if possiblwWays(arr, n, 0, 0) == 1:
	print('YES')
else:
	print('NO')


a = int(input())
b = [int(input()) for i in ' ' * a]
for i in range(1 << a):
	s = 0
	for j in range(a):
		if i & 1 << j:
			s += b[j]
		else:
			s -= b[j]
	if s % 360 == 0:
		exit(print('YES'))
print('NO')


from itertools import product as prd
n = int(input())
s = '{}'.join([input() for i in range(n)])
if eval(s.format(*'+' * n)) >= 360:
	for i in prd('+-', repeat=n):
		if not eval(s.format(*i)) % 360:
			print('YES')
			break
	else:
		print('NO')
else:
	for i in prd('+-', repeat=n):
		if not eval(s.format(*i)):
			print('YES')
			break
	else:
		print('NO')


import sys

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

def ves(a):
	su = 0
	for i in range(len(a)):
		if a[i] == '0':
			su += x[i]
		if a[i] == '1':
			su -= x[i]
	return su

def tostr(a):
	a = a[2:]
	if len(a) < n:
		a = '0' * (n - len(a)) + a
	return a
n = int(input())
x = []
for i in range(n):
	x.append(int(input()))
a = '0b0'
mi = 9999999
b = tostr(a)
while len(b) == n:
	mi = abs(ves(b))
	if mi % 360 == 0:
		print('YES')
		exit(0)
	a = bin(int(a, 2) + 1)
	b = tostr(a)
print('NO')


n = int(input())
x = [int(input()) for _ in range(n)]
ans = False
for i in range(2 ** n):
	signs = bin(i)[2:].zfill(n)
	s = 0
	for j in range(n):
		if signs[j] == '0':
			s = (s + x[j]) % 360
		else:
			s = (s - x[j]) % 360
	ans = ans or s == 0
print('YES' if ans else 'NO')


a = int(input())
z = []
for i in range(a):
	x = int(input())
	z.append(x)
flag = 0
for i in range(pow(2, a) - 1):
	m = bin(i)
	m = m[2:]
	ans = ''
	for i in range(a - len(m)):
		ans += '0'
	ans = ans + m
	total = 0
	for i in range(len(ans)):
		if ans[i] == '0':
			total -= z[i]
		else:
			total += z[i]
	total = abs(total)
	if total % 360 == 0:
		print('YES')
		flag = 1
		exit()
print('NO')


import math

def printSubsequences(arr, n, a):
	c = 0
	opsize = math.pow(2, n)
	for counter in range(1, int(opsize)):
		ans = 0
		for j in range(0, n):
			if counter & 1 << j:
				ans += arr[j]
		if ans == a:
			c += 1
	return c
n = int(input())
l = []
s = 0
for i in range(0, n):
	a = int(input())
	l.append(a)
	s += a
if n == 1:
	if s != 360:
		print('NO')
	else:
		print('YES')
elif s % 360 == 0:
	print('YES')
elif s % 2 != 0:
	print('NO')
else:
	a = s // 2
	if s < 360:
		d = printSubsequences(l, n, a)
		if d > 0:
			print('YES')
		else:
			print('NO')
	else:
		d = printSubsequences(l, n, a)
		if d > 0:
			print('YES')
		else:
			a = (s - 360) // 2
			d = printSubsequences(l, n, a)
			if d > 0:
				print('YES')
			else:
				print('NO')


def is360degree(l, np):
	sum = 0
	for i in range(len(l)):
		if np[i] == '0':
			sum -= l[i]
		else:
			sum += l[i]
	if sum % 360 == 0:
		return True
	else:
		return False
l = []
result = 0
length = int(input())
for i in range(length):
	n = int(input())
	l.append(n)
times = 0
while times < 2 ** length:
	norp = bin(times)
	n = norp[2:]
	m = n.rjust(length, '0')
	if is360degree(l, m) == True:
		result = True
		break
	times += 1
if result == True:
	print('YES')
else:
	print('NO')


n = int(input())
a = [0]
for i in range(n):
	b = []
	p = int(input())
	for j in a:
		b.append(j + p)
	for j in a:
		b.append(j - p)
	a = b[:]
for i in b:
	if i % 360 == 0:
		exit(print('YES'))
print('NO')


n = int(input())
md = 360
a = [int(input()) for i in range(n)]
for i in range(2 ** n):
	b = bin(i)
	sol = 0
	for j in range(len(b) - 2):
		if b[-(j + 1)] == '0':
			sol += a[j]
		else:
			sol -= a[j]
	for j in range(len(b) - 2, n):
		sol += a[j]
	if sol % md == 0:
		print('YES')
		exit()
print('NO')


import sys
n = int(input())
s = []
for i in range(n):
	s.append(int(input()))
if sum(s) % 360 == 0:
	print('YES')
	sys.exit()
for i in range(2 ** len(s)):
	count = 0
	x = list(str(bin(i))[2:])
	x1 = [-1 for i in range(len(s))]
	for i in range(len(x)):
		if x[i] == '1':
			x1[i] = 1
		elif x[i] == '0':
			x1[i] = -1
	for m in range(len(s)):
		count += s[m] * x1[m]
	if count % 360 == 0:
		print('YES')
		sys.exit()
print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
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 [int(x) for x in sys.stdin.readline().split()]

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 main():
	n = I()
	a = [I() for _ in range(n)]
	d = set()
	d.add(0)
	for c in a:
		n = set()
		for k in d:
			n.add((k + c) % 360)
			n.add((k - c) % 360)
		d = n
	if 0 in d:
		return 'YES'
	return 'NO'
print(main())


from itertools import combinations
n = int(input().strip())
a = []
for i in range(n):
	a.append(int(input().strip()))
totasl = sum(a)
if totasl % 360 == 0:
	print('YES')
	exit()
if totasl % 2 == 1:
	print('NO')
	exit()
for i in range(n):
	for k in combinations(a[:n - 1], i):
		if abs(totasl - 2 * sum(k)) % 360 == 0:
			print('YES')
			exit()
print('NO')


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

def getdict(n):
	d = {}
	if type(n) is list:
		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 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 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 prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)
n = ii()
d = [ii() for i in range(n)]
for i in range(2 ** n):
	t = i
	r = 0
	for j in range(n):
		r += (-1) ** (1 & t) * d[j]
		t = t >> 1
	if r % 360 == 0:
		exit(print('YES'))
print('NO')


a = int(input())
s = []
for x in range(a):
	s = s + [int(input())]
f = 'NO'
z = 0
while f == 'NO' and z < 2 ** a:
	q = z * 1
	w = 0
	for x in range(a):
		if q % 2 == 0:
			w = w + s[x]
		else:
			w = w - s[x]
		q = q // 2
	if w % 360 == 0:
		f = 'YES'
	z = z + 1
print(f)


def ch(pos, rem):
	if pos == n:
		if rem % 360 == 0:
			print('YES')
			exit(0)
		return
	ch(pos + 1, rem + l[pos])
	ch(pos + 1, rem - l[pos])
n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
ch(0, 0)
print('NO')


x = int(input())
a = []
for i in range(x):
	n = int(input())
	a.append(n)
b = []
ans = 'NO'
for j in range(2 ** x):
	t = []
	p = 0
	for i in range(x):
		y = j % 2
		j //= 2
		if y == 0:
			p += a[i]
		else:
			p -= a[i]
	if abs(p) % 360 == 0:
		ans = 'YES'
		break
print(ans)


import itertools
n = int(input())
a_list = [int(input()) for i in range(n)]
flag = False
for muki in itertools.product(*tuple([[1, -1]] * n)):
	out = sum([a_list[i] * muki[i] for i in range(n)])
	if out % 360 == 0:
		flag = True
		break
out_txt = 'YES' if flag else 'NO'
print(out_txt)


import itertools
n = int(input())
degrees = []
total = 0
for i in range(n):
	degrees.append(int(input()))
	total += degrees[i]
if total % 360 == 0:
	print('YES')
else:
	flag = 0
	for i in range(n):
		for subset in itertools.combinations(degrees, i):
			tot = total - 2 * sum(subset)
			if tot % 360 == 0:
				print('YES')
				flag = 1
				break
		if flag == 1:
			break
	if flag == 0:
		print('NO')


def calculate_by_mask(array, mask):
	out = 0
	for (i, elem) in enumerate(array):
		if mask & 1 << i:
			out = (out + elem) % 360
		else:
			out = (out - elem) % 360
	return out

def check_comparability(array):
	for i in range(0, 2 ** len(array)):
		if calculate_by_mask(array, i) == 0:
			return True
	return False

def main():
	n = int(input())
	inp = list()
	for _ in range(n):
		inp.append(int(input()))
	print('YES' if check_comparability(inp) else 'NO')
main()


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
i = 0
temp = [0]
temp2 = []
while i < n:
	for c in temp:
		temp2.append(c + a[i])
		temp2.append(c - a[i])
	temp = temp2
	temp2 = []
	i += 1
f = 0
for c in temp:
	if c % 360 == 0:
		f = 1
if f:
	print('YES')
else:
	print('NO')


import sys
fline = input()
num_inputs = int(fline)
inputs = []
for i in range(num_inputs):
	inputs.append(int(input()))
total_cases = 1 << num_inputs
for mask in range(total_cases):
	b = 0
	for i in range(num_inputs):
		if mask & 1 << i > 0:
			b -= inputs[i]
		else:
			b += inputs[i]
	if b % 360 == 0:
		print('YES')
		sys.exit()
print('NO')


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
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 = I()
x = []
for i in range(n):
	h = I()
	if i == 0:
		x.append(+h)
		x.append(-h)
		c = 2
	if i < n - 1 and i > 0:
		for j in range(c):
			key = x[0]
			x = x[1:]
			x.append(key + h)
			x.append(key - h)
		c *= 2
	if i == n - 1:
		if i == 0:
			h = 0
		for j in range(c):
			key = x[0]
			x = x[1:]
			if (key + h) % 360 == 0 or key - h == 360:
				print('YES')
				exit()
print('NO')


n = int(input())
l = list(range(2 ** n))
a = [0] * n
for i in range(n):
	a[i] = int(input())
for x in l:
	s = 0
	for i in range(n):
		if x & 1 << i:
			s += a[i]
		else:
			s -= a[i]
	s %= 360
	if s == 0:
		print('YES')
		break
if not s == 0:
	print('NO')


n = int(input())
l = []
for i in range(n):
	x = int(input())
	l.append(x)
l.sort()
res = 'No'
y = 0
l1 = []
l1.append(l[0])
for i in range(1, len(l)):
	x = len(l1)
	a = l[i]
	for j in range(y, x):
		l1.append(l1[j] + a)
		l1.append(l1[j] - a)
		if i == len(l) - 1 and ((l1[j] + a) % 360 == 0 or (l1[j] - a) % 360 == 0):
			res = 'Yes'
	y = x
print(res)


def func(arr, i):
	for j in range(i, len(arr)):
		arr1 = arr.copy()
		arr1[j] = -arr[j]
		if func(arr, i + 1) == 1 or func(arr1, i + 1) == 1:
			return 1
		else:
			return 0
	if sum(arr) == 0 or sum(arr) % 360 == 0:
		return 1
	return 0
N = int(input())
arr = []
for i in range(N):
	arr.append(int(input()))
a = func(arr, 0)
if a == 1:
	print('YES')
else:
	print('NO')


n = int(input())
ans = False
arr = []
for i in range(n):
	t = int(input())
	arr.append(t % 360)

def lock(arr, index, deg, clockwise):
	global ans
	if index == n:
		if deg == 0:
			ans = True
			return
		else:
			return
	if clockwise:
		deg = deg + arr[index]
		deg = deg % 360
	else:
		deg = deg - arr[index]
		deg = deg % 360
	lock(arr, index + 1, deg, True)
	lock(arr, index + 1, deg, False)
lock(arr, 0, 0, True)
lock(arr, 0, 0, False)
if ans == True:
	print('YES')
else:
	print('NO')


import sys
from atexit import register
from io import StringIO as stream
inf = float('inf')
mod = 1000000007

def fast_io():
	sys.stdin = stream(sys.stdin.read())
	sys.stdout = stream()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))

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

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

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

def recurse(arr, i, angle):
	if i == n:
		return True if angle % 360 == 0 else False
	return recurse(arr, i + 1, angle + arr[i]) or recurse(arr, i + 1, angle - arr[i])
n = int(input())
arr = [0] * n
for i in range(n):
	arr[i] = int(input())
print('YES') if recurse(arr, 0, 0) == True else print('NO')


num = int(input())
arr = []
for i in range(num):
	arr.append(int(input()))

def solve():
	for i in range(1, 1 << num):
		total = 0
		for j in range(num):
			if i & 1 << j:
				total += arr[j]
			else:
				total -= arr[j]
		if total % 360 == 0:
			return 'YES'
	return 'NO'
print(solve())


II = lambda : int(input())
MI = lambda : map(int, input().split())

def check(A, i):
	s = 0
	for k in range(len(A)):
		if i % 2:
			s += A[k]
		else:
			s -= A[k]
		i = i // 2
	return s % 360 == 0

def main():
	N = II()
	A = [II() for _ in range(N)]
	for i in range(2 ** N):
		if check(A, i):
			return True
	return False
print(['NO', 'YES'][main()])


import sys
input = sys.stdin.readline
N = int(input())
aN = [int(input()) for i in range(N)]
for i in range(1 << N):
	ans = 0
	for j in range(N):
		if i >> j & 1:
			ans += aN[j]
		else:
			ans -= aN[j]
	if ans % 360 == 0:
		print('YES')
		exit()
print('NO')


from itertools import chain, combinations

def powerset(iterable):
	xs = list(iterable)
	return chain.from_iterable((combinations(xs, n) for n in range(len(xs) + 1)))
n = int(input())
l = []
for _ in range(n):
	l.append(int(input()) % 360)
s = sum(l)
res = list(powerset(l))
bol = True
for i in res:
	if sum(i) % 360 == (s - sum(i)) % 360:
		bol = False
		break
if bol:
	print('NO')
else:
	print('YES')


n = int(input())
k = [0] * n
for i in range(n):
	k[i] = int(input())
for i in range(1 << n):
	flag = 0
	sum = 0
	for j in range(n):
		if i & 1 << j:
			sum += k[j]
		else:
			sum -= k[j]
	if sum % 360 == 0:
		flag = 1
		print('YES')
		break
if flag == 0:
	print('NO')


n = int(input())
a = [int(input()) for k in range(n)]

def total(x, now):
	global n
	if now == n:
		if x % 360 == 0:
			print('YES')
			quit()
	else:
		total(x + a[now], now + 1)
		total(x - a[now], now + 1)
total(0, 0)
print('NO')


def check(a):
	n = len(a)
	for i in range(0, 2 ** n):
		sum = 0
		j = 0
		while j < n:
			if i % 2 == 0:
				sum += a[j]
			else:
				sum -= a[j]
			i = i // 2
			j += 1
		if sum % 360 == 0:
			print('YES')
			break
	else:
		print('NO')
n = int(input())
i = 0
a = []
while i < n:
	buff = int(input())
	a.append(buff)
	i += 1
check(a)


n = int(input())
seq = []
for _ in range(n):
	seq.append(int(input()))
get = False
for i in range(2 ** n):
	tmp = bin(i)[2:][::-1]
	while len(tmp) < n:
		tmp += '0'
	ans = 0
	for j in range(len(tmp)):
		k = tmp[j]
		if k == '0':
			ans -= seq[j]
		else:
			ans += seq[j]
	ans %= 360
	if ans == 0:
		get = True
		break
if get:
	print('YES')
else:
	print('NO')


import math

def Subsequences():
	s = int(math.pow(2, n))
	for counter in range(1, s):
		sm = 0
		for j in range(n):
			if counter & 1 << j:
				sm += a[j]
		if cs != sm and (cs == 2 * sm or (cs - 2 * sm) % 360 == 0):
			return True
	return False
n = int(input())
a = [0] * n
for i in range(n):
	a[i] = int(input())
cs = sum(a)
if cs % 360 == 0:
	print('YES')
elif Subsequences():
	print('YES')
else:
	print('NO')


a = [0]
for _ in range(int(input())):
	r = int(input())
	b = []
	for i in a:
		b.append((i + r) % 360)
		b.append((i - r) % 360)
	a = list(set(b))
if a.count(0) >= 1:
	print('YES')
else:
	print('NO')


n = int(input())
L = []
for i in range(n):
	L.append(int(input()))
L2 = [L[0]]
for i in range(1, n):
	L3 = []
	for j in range(len(L2)):
		L3.append(L2[j] + L[i])
		L3.append(L2[j] - L[i])
	L2 = L3[:]
OP = 'NO'
for x in L2:
	if x % 360 == 0:
		OP = 'YES'
		break
print(OP)


def isSubsetSum(arr, n, sum):
	if sum == 0:
		return True
	if n == 0 and sum != 0:
		return False
	if arr[n - 1] > sum:
		return isSubsetSum(arr, n - 1, sum)
	return isSubsetSum(arr, n - 1, sum) or isSubsetSum(arr, n - 1, sum - arr[n - 1])

def findPartion(arr, n, j):
	sum = 360 * j
	for i in range(0, n):
		sum += arr[i]
	if sum % 2 != 0:
		return False
	return isSubsetSum(arr, n, sum // 2)
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
flag = False
for j in range(16):
	flag = flag or findPartion(a, n, j)
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
num = 1 << n
for j in range(num):
	sign_list = [1] * n
	count = 0
	while j:
		if j % 2 == 1:
			sign_list[count] = -1
		count += 1
		j = j // 2
	new_a = []
	for i in range(len(a)):
		new_a.append(a[i] * sign_list[i])
	if sum(new_a) == 0 or sum(new_a) % 360 == 0:
		print('YES')
		exit(0)
print('NO')


n = int(input())
a = [int(input()) for i in range(n)]
done = False
for i in range(1 << n):
	ans = 0
	for j in range(n):
		if i >> j & 1:
			ans += a[j]
		else:
			ans -= a[j]
	if ans % 360 == 0:
		print('YES')
		done = True
		break
if not done:
	print('NO')


n = int(input())
a = [0]
for _ in range(n):
	curr = int(input())
	mods = []
	for o in a:
		mods.extend([o + curr, o - curr])
	a = mods[:]
print('YES' if any((x % 360 == 0 for x in a)) else 'NO')


l = [0]
k = []
n = int(input())
for i in range(n):
	k.append(int(input()))

def solve(ptr, sums, n):
	if ptr >= n:
		if sums % 360 == 0 or sums == 0:
			l[0] = 1
		return
	solve(ptr + 1, sums + k[ptr], n)
	solve(ptr + 1, sums - k[ptr], n)
solve(0, 0, n)
if l[0]:
	print('YES')
else:
	print('NO')