import sys



n = eval(input())

v = list(map(int, input().split(' ')))

startHere = [0 for i in range(n)]



if sum(v) % ((n * (n + 1)) / 2) != 0:

	print("NO")

	sys.exit()



operations = sum(v) / ((n * (n + 1)) / 2)



for i in range(n):

	diff = v[(i + 1) % n] - v[i]



	startHere[i] = (operations - diff) / n



contribution = 0

gathered = 0



for i in range(n):

	v[i] -= contribution

	gathered += startHere[i % n]

	contribution += gathered



for i in range(n):

	v[i] -= contribution

	gathered -= startHere[i % n]

	contribution -= startHere[i % n] * n

	contribution += gathered



if min(startHere) >= 0 and sum(startHere) == operations and min(v) == 0 and max(v) == 0:

	print("YES")

else:

	print("NO")

import sys



n = eval(input())

v = list(map(int, input().split(' ')))

startHere = [0 for i in range(n)]



if sum(v) % ((n * (n + 1)) / 2) != 0:

	print("NO")

	sys.exit()



operations = sum(v) / ((n * (n + 1)) / 2)

operationsFound = 0



for i in range(n):

	diff = v[(i + 1) % n] - v[i]



	if (operations - diff) % n != 0 or operations - diff < 0:

		print("NO")

		sys.exit()

	else:

		operationsFound += (operations - diff) / n



if operationsFound == operations:

	print("YES")

else:

	print("NO")

import sys

n = eval(input())
v = list(map(int, input().split(" ")))
startHere = [0 for i in range(n)]
if sum(v) % ((n * (n + 1)) / 2) != 0:
    print("NO")
    sys.exit()
operations = sum(v) / ((n * (n + 1)) / 2)
for i in range(n):
    diff = v[(i + 1) % n] - v[i]
    startHere[i] = (operations - diff) / n
contribution = 0
gathered = 0
for i in range(n):
    v[i] -= contribution
    gathered += startHere[i % n]
    contribution += gathered
for i in range(n):
    v[i] -= contribution
    gathered -= startHere[i % n]
    contribution -= startHere[i % n] * n
    contribution += gathered
if min(startHere) >= 0 and sum(startHere) == operations and min(v) == 0 and max(v) == 0:
    print("YES")
else:
    print("NO")

import sys

n = eval(input())
v = list(map(int, input().split(" ")))
startHere = [0 for i in range(n)]
if sum(v) % ((n * (n + 1)) / 2) != 0:
    print("NO")
    sys.exit()
operations = sum(v) / ((n * (n + 1)) / 2)
operationsFound = 0
for i in range(n):
    diff = v[(i + 1) % n] - v[i]
    if (operations - diff) % n != 0 or operations - diff < 0:
        print("NO")
        sys.exit()
    else:
        operationsFound += (operations - diff) / n
if operationsFound == operations:
    print("YES")
else:
    print("NO")

+operationsFound = 0 -    startHere[i] = (operations - diff) / n -contribution = 0 -gathered = 0 -for i in range(n): -    v[i] -= contribution -    gathered += startHere[i % n] -    contribution += gathered -for i in range(n): -    v[i] -= contribution -    gathered -= startHere[i % n] -    contribution -= startHere[i % n] * n -    contribution += gathered -if min(startHere) >= 0 and sum(startHere) == operations and min(v) == 0 and max(v) == 0: +    if (operations - diff) % n != 0 or operations - diff < 0: +        print("NO") +        sys.exit() +    else: +        operationsFound += (operations - diff) / n +if operationsFound == operations: