You are given N boxes arranged in a circle, each containing a certain number of stones. You need to determine if it's possible to remove all the stones by repeatedly performing an operation: select a box, then for each subsequent box, remove an increasing number of stones. If it's not possible to perform the operation due to insufficient stones in a box, print "NO"; otherwise, print "YES".

# Buggy version:
n = int(input())

a = [int(_) for _ in input().split()]


if sum(a) % (n*(n+1)//2) != 0:
    print("NO")
    exit()

m = sum(a)//(n*(n+1)//2)
# print(m)
d = [a[i]-a[i-1]-m for i in range(n)]

# print(d)
for D in d:
    if D % n == 0:
        m += D//n
    if D % n != 0 or D < 0:
        print("NO")
        exit()
if m == 0:
    print("YES")
else:
    print("NO")


# Fixed version:
n = int(input())

a = [int(_) for _ in input().split()]


if sum(a) % (n*(n+1)//2) != 0:
    print("NO")
    exit()

m = sum(a)//(n*(n+1)//2)
# print(m)
d = [a[i]-a[i-1]-m for i in range(n)]

# print(d)
for D in d:
    if D % n == 0:
        m += D//n
    if D % n != 0 or D > 0:
        print("NO")
        exit()
if m == 0:
    print("YES")
else:
    print("NO")

# Buggy version:
n = int(input())
a = [int(i) for i in input().split()]
if sum(a) % (n * (n + 1) // 2) != 0:
    print("NO")
    exit()
if n == 1:
    print("YES")
    exit()

k = sum(a) // (n * (n + 1) // 2)

if n == 2:
    if min(a) >= k:
        print("YES")
    else:
        print("NO")
    exit()

l = 0
for i in range(n):
    j = (i + 1) % n
    m = a[j]-a[i]
    if (m - k) % n != 0 or (m - k) // n <= 0:
        print("NO")
        exit()
    l -= (m - k) // n
if k == l:
    print("YES")
else:
    print("NO")


# Fixed version:
n = int(input())
a = [int(i) for i in input().split()]
if sum(a) % (n * (n + 1) // 2) != 0:
    print("NO")
    exit()

k = sum(a) // (n * (n + 1) // 2)

l = 0
for i in range(n):
    j = (i + 1) % n
    m = a[i]-a[j]
    if (m + k) % n != 0 or (m + k) // n < 0:
        print("NO")
        exit()
    l += (m + k) // n
if k == l:
    print("YES")
else:
    print("NO")

# Buggy version:
N, *A = map(int, open(0).read().split())
M = (N+1)*N//2
S = sum(A)
if S%M!=0:
  print('NO')
  exit()
cnt = S//M
for i in range(N):
  df = A[(i+1)%N]-A[i]
  if (cnt-df)%N!=0 or cnt<df:
    print('NO')
    break
else:
  print('Yes')

# Fixed version:
N, *A = map(int, open(0).read().split())
M = (N+1)*N//2
S = sum(A)
if S%M!=0:
  print('NO')
  exit()
cnt = S//M
for i in range(N):
  df = A[(i+1)%N]-A[i]
  if (cnt-df)%N!=0 or cnt<df:
    print('NO')
    break
else:
  print('YES')

# Buggy version:
n = int(input())
a = list(map(int, input().split()))
t = n * (n + 1) // 2
s = sum(a)
if s % t:
    print('NO')
else:
    c = s // t
    b = [0] * n
    for i in range(n):
        b[i] = a[i] - a[i - 1] - c
    for i in range(n):
        if b[i] % n or k < 0:
            print('NO')
            break
    else:
        print('YES')


# Fixed version:
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
if (2 * s) % (n * (n + 1)) != 0:
    print('NO')
else:
    t = (2 * s) // (n * (n + 1))
    for i in range(n - 1):
        k = a[i - 1] - a[i] + t
        if k % n or k < 0:
            print('NO')
            break
    else:
        print('YES')

# Buggy version:
def examA():
    N = I()
    A = LI()
    ans = "YES"
    cur = 0
    for a in A:
        if a%2==1:
            cur +=1
    if cur%2==1:
        ans = "NO"
    print(ans)
    return

def examB():
    N = I()
    A = LI()
    ans = "YES"
    sumA = sum(A)
    oneA = (1+N)*N//2
    if sumA%oneA>0:
        ans = "NO"
    ope = sumA//oneA
    #各Aについて何回始点としたか二分探索
    cur = 0
    for i in range(N):
        now = ope - (A[i]-A[i-1])
        if now%N>0:
#            print(now,i)
            ans = "NO"
            break
        cur += now//N
    if cur==ope:
        ans = "NO"
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = 10**18

if __name__ == '__main__':
    examB()


# Fixed version:
def examA():
    N = I()
    A = LI()
    ans = "YES"
    cur = 0
    for a in A:
        if a%2==1:
            cur +=1
    if cur%2==1:
        ans = "NO"
    print(ans)
    return

def examB():
    N = I()
    A = LI()
    ans = "YES"
    sumA = sum(A)
    oneA = (1+N)*N//2
    if sumA%oneA!=0:
        ans = "NO"
    ope = sumA//oneA
    #各Aについて何回始点としたか二分探索
    cur = 0
    for i in range(N):
        now = ope - (A[i]-A[i-1])
        if now%N!=0 or now<0:
#            print(now,i)
            ans = "NO"
            break
        cur += now//N
    if cur!=ope:
        ans = "NO"
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = 10**18

if __name__ == '__main__':
    examB()

# Buggy version:
n = int(input())
a = list(map, input().split())
suma = sum(a)
if sum(a) % (n*(n+1)//2) > 0:
  print('NO')
  exit()
k = 2*suma//(n*(n+1))
diffs = [a[i+1] - a[i] + k for i in range(n-1)]
if all([d % n == 0 for d in diffs]):
  print('YES')
else:
  print('NO')


# Fixed version:
n = int(input())
a = list(map(int, input().split()))
if n == 1:
    print('YES')
    exit()
suma = sum(a)
if sum(a) % (n*(n+1)//2) > 0:
    print('NO')
    exit()
k = 2*suma//(n*(n+1))
diffs = [a[i+1] - a[i] - k for i in range(-1, n-1)]
if all([d<=0 and -d % n == 0 for d in diffs]):
    print('YES')
else:
    print('NO')

# Buggy version:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

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

n = getN()
nums = getList()
if sum(nums) % ((n * (n+1)) // 2) != 0:
    print("NO")
    sys.exit()
n_operate = sum(nums) // ((n * (n+1)) // 2)

v_valid = n_operate
v_sign = n

for i, j in zip(nums, nums[1:] + [nums[0]]):
    diff = j - i
    if diff > v_valid:
        print("NO")
        sys.exit()
    if (v_valid - diff) % v_sign != 0:
        print("NO")
        sys.exit()
    n_operate -= (v_valid - diff) // v_sign
    print(n_operate)
if n_operate == 0:
    print("YES")
else:
    print("NO")
# print("YES")

# Fixed version:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

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

n = getN()
nums = getList()
if sum(nums) % ((n * (n+1)) // 2) != 0:
    print("NO")
    sys.exit()
n_operate = sum(nums) // ((n * (n+1)) // 2)

v_valid = n_operate
v_sign = n

for i, j in zip(nums, nums[1:] + [nums[0]]):
    diff = j - i
    if diff > v_valid:
        print("NO")
        sys.exit()
    if (v_valid - diff) % v_sign != 0:
        print("NO")
        sys.exit()
    n_operate -= (v_valid - diff) // v_sign
    # print(n_operate)
if n_operate == 0:
    print("YES")
else:
    print("NO")
# print("YES")

# Buggy version:
n=int(input())
arr=list(map(int,input().split()))
if n==1:
  print('YES')
else:
  sum1=sum(arr)
  sum2=(n*(n+1))//2
  moves=sum1//sum2
  cnt=0
  if sum1%sum2!=0:
    print('NO')
  else:
    flag=True
    for i in range(n-1):
      tmp=arr[i]+moves
      if arr[i+1]==moves:
        continue
      else:
        diff=tmp-arr[i+1]
        if diff%moves!=0:
          flag=False
        else:
          cnt+=diff//moves
    if flag==False:
      print('NO')
    else:
      if cnt<=moves:
        print('YES')
      else:
        print('NO')

# Fixed version:
n=int(input())
arr=list(map(int,input().split()))
if n==1:
  print('YES')
else:
  sum1=sum(arr)
  sum2=(n*(n+1))//2
  moves=sum1//sum2
  cnt=0
  if sum1%sum2!=0:
    print('NO')
  else:
    flag=True
    arr2=[]
    for i in range(n-1):
      tmp=arr[i]+moves
      if arr[i+1]==tmp:
        continue
      else:
        diff=tmp-arr[i+1]
        if diff%n!=0:
          flag=False
        else:
          arr2.append(n-i)
          cnt+=diff//n
          tmp=arr[i+1]-diff//n
          if tmp>n*(moves-diff//n):
            flag=False
    if flag==False:
      print('NO')
    else:
      if len(arr2)==moves:
        if arr[0]==sum(arr2):
          print('YES')
        else:
          print('NO')
      elif len(arr2)>moves:
        print('NO')
      else:
        if 1*(moves-len(arr2))<=arr[0]-sum(arr2)<=n*(moves-len(arr2)):
          print('YES')
        else:
          print('NO')

# Buggy version:
#n,a,b,c,d=map(int,input().split())
n=int(input())
a=[int(i) for i in input().split()]
ans=False
c=[]

t=sum(a)//((n*(n+1))//2)

if sum(a)%((n*(n+1))//2)!=0:
    ans=False
else:
    if n==1:
        ans=True
        break
    for i in range(n):
        if i==0:
            d=a[0]-a[-1]
        else:
            d=a[i]-a[i-1]
        if (t-d)%n!=0:
            ans=False
            break
        s=(t-d)//n
        c.append(s)
    if sum(c)==t:
        ans=True
print('YES' if ans else 'NO')

# Fixed version:
#n,a,b,c,d=map(int,input().split())
n=int(input())
a=[int(i) for i in input().split()]
ans=True
c=[]

t=sum(a)//((n*(n+1))//2)

if sum(a)%((n*(n+1))//2)!=0:
    ans=False
else:
    for i in range(n):
        if i==0:
            d=a[0]-a[-1]
        else:
            d=a[i]-a[i-1]
        if (t-d)%n!=0 or d-t>0:
            ans=False
            break
        s=(t-d)//n
        c.append(s)
    #if sum(c)==t:
        #ans=True
if n==1:
    ans=True
print('YES' if ans else 'NO')

# Buggy version:
n=int(input())
A=list(map(int,input().split()))
N=((n)*(n+1))//2

if sum(A)%N!=0:
    print("NO")
    exit()
elif n==1:
    print("YES")
elif n==2:
    if (A[1]+A[0])%3==0:
        print("YES")
        exit()
    else:
        print("NO")
        exit()
else:
    T=(sum(A)//N)
    A+=[A[0]]
    cnt=0
    for i in range(1,len(A)):
        if (A[i]-A[i-1])==T:
            #print(A[i],A[i-1])
            continue
        else:
            if A[i-1]>A[i]-T:
                B=((A[i-1]-A[i])//n)+1
                cnt+=B
                print(A[i],A[i-1],n*B)
                if (A[i]-A[i-1]+n*B)==T:
                    continue
                else:
                    print("NO")
                    exit()
            else:
                print("NO")
                exit()
    if T==cnt:
        print("YES")
    else:
        print("NO")
    

# Fixed version:
n=int(input())
A=list(map(int,input().split()))
N=((n)*(n+1))//2

if sum(A)%N!=0:
    print("NO")
    exit()
elif n==1:
    print("YES")
elif n==2:
    if sum(A)%3==0 and max(A)<=2*min(A):
        print("YES")
    else:
        print("NO")
else:
    T=(sum(A)//N)
    A+=[A[0]]
    cnt=0
    for i in range(1,len(A)):
        if (A[i]-A[i-1])==T:
            #print(A[i],A[i-1])
            continue
        else:
            if A[i-1]>A[i]-T:
                B=((A[i-1]-A[i])//n)+1
                cnt+=B
                #print(A[i],A[i-1],n*B)
                if (A[i]-A[i-1]+n*B)==T:
                    continue
                else:
                    print("NO")
                    exit()
            else:
                print("NO")
                exit()
    if T==cnt:
        print("YES")
    else:
        print("NO")

# Buggy version:
import sys
N=int(input())
A=[int(i) for i in input().split()]
if sum(A)%((N*(N+1))//2)!=0:
    print('NO')
    sys.exit()
k=sum(A)//((N*(N+1))//2)
for a in A:
    if a-k<0 and (k-a)%N==0:
        continue
    print('NO')
    sys.exit()
print('YES')

# Fixed version:
import sys
N=int(input())
A=[int(i) for i in input().split()]
if sum(A)%((N*(N+1))//2)!=0:
    print('NO')
    sys.exit()
k=sum(A)//((N*(N+1))//2)
B=[0]*N
for i in range(N):
    B[i]=A[i]-A[i-1]
for a in B:
    if a-k<=0 and (k-a)%N==0:
        continue
    print('NO')
    sys.exit()
print('YES')

# Buggy version:
n = int(input())
a = list(map(int, input().split()))

s = sum(a)

if s%(n*(n+1)//2)!=0:
    print('NO')
    exit()

ss = s//(n*(n+1)//2)

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

# a[i]-a[i-1] = ss-b[i-1]*n
for i in range(n):
    b[i-1] = (ss-a[i]+a[i-1])//n
    if b[i-1]<0:
        print('NO')
        exit()

c = [0 for i in range(n)]
for i in range(n):
    c[0]+=b[i]*(n-i)

for i in range(1,n):
    c[i] = c[i-1] + ss - b[i-1]*n

if a==c:
    print('YES')
else:
    print('NO')

print(b)


# Fixed version:
n = int(input())
a = list(map(int, input().split()))

s = sum(a)

if s%(n*(n+1)//2)!=0:
    print('NO')
    exit()

ss = s//(n*(n+1)//2)

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

# a[i]-a[i-1] = ss-b[i-1]*n
for i in range(n):
    b[i-1] = (ss-a[i]+a[i-1])//n
    if b[i-1]<0:
        print('NO')
        exit()

c = [0 for i in range(n)]
for i in range(n):
    c[0]+=b[i]*(n-i)

for i in range(1,n):
    c[i] = c[i-1] + ss - b[i-1]*n

if a==c:
    print('YES')
else:
    print('NO')

# Buggy version:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    k = sum(A)//(N*(N+1)//2)
    if sum(A) % (N*(N+1)//2) != 0 or True:
        return "NO"

    D = [0]*N
    for i in range(N-1):
        D[i] = A[i+1]-A[i]-k
    D[-1] = A[0]-A[-1]-k

    cnt = sum([v//N for v in D])
    if all(x <= 0 and -x % N == 0 for x in D)and -cnt == k:
        return "YES"
    else:
        return "NO"


print(solve())


# Fixed version:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    k = sum(A)//(N*(N+1)//2)
    if sum(A) % (N*(N+1)//2) != 0:
        return "NO"

    D = [0]*N
    for i in range(N-1):
        D[i] = A[i+1]-A[i]-k
    D[-1] = A[0]-A[-1]-k

    cnt = sum([v//N for v in D])
    if all(x <= 0 and -x % N == 0 for x in D)and -cnt == k:
        return "YES"
    else:
        return "NO"


print(solve())

# Buggy version:
# -*- coding: utf-8 -*-

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	ret_ng='NO'
	ret_ok='YES'
	return ret_ng
	
	n=int(io())
	l= list(map(int, io().split()))
	
	v_one_act =n*(n+1)/2
	
	if sum(l)%v_one_act != 0:
		return ret_ng
		
	act_num=sum(l)//v_one_act	
	st_num=0
	for a,b in zip(l, l[1:]+l):
		diff = b - a
		if (diff - act_num)%(n)!=0:
			return ret_ng
		st=-1*(diff-act_num)//(n)
		st_num+=st
	
	#if act_num!=st_num:
	#	return ret_ng
		
	return ret_ok

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))


# Fixed version:
# -*- coding: utf-8 -*-

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	ret_ng='NO'
	ret_ok='YES'
	
	n=int(io())
	l= list(map(int, io().split()))
	
	v_one_act =n*(n+1)/2
	
	if sum(l)%v_one_act != 0:
		return ret_ng
		
	act_num=sum(l)//v_one_act	
	st_num=0
	
	for a,b in zip(l, l[1:]+l):
		diff = b - a
		if (act_num-diff)%(n)!=0:
			return ret_ng
		if (act_num-diff)<0:
			return ret_ng
		st= (act_num-diff)//(n)
		st_num+=st
	
	if act_num!=st_num:
		return ret_ng
		
	
		
	return ret_ok

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

# Buggy version:
n = int(input())
a = list(map(int,input().split()))

b = [] #差
for i in range(1,n):
    b.append(a[i]-a[i-1])
b.append(a[0]-a[n-1])

w = n*(n+1)//2 #一回の操作で取り除く石の数

if sum(a)%w != 0:
    print('NO')
else:
    res = 0
    c = sum(a)//w #操作回数
    for i in range(n):
        b[i]-=c
    
    for i in range(1,n):
        if (-b[i]) % 5 == 0 and b[i] <= 0:
            res += (-b[i])//5
        else:
            print('NO')
            break
            
    if res == c:
        print('Yes')
    else:

        print('NO')

# Fixed version:
n = int(input())
a = list(map(int,input().split()))

b = [] #差
for i in range(1,n):
    b.append(a[i]-a[i-1])
b.append(a[0]-a[n-1])

w = n*(n+1)//2 #一回の操作で取り除く石の数


if sum(a)%w != 0:
    print('NO')
else:
    res = 0
    c = sum(a)//w #操作回数
    for i in range(n):
        b[i]-=c
    
    for i in range(n):
        if (-b[i]) % n == 0 and b[i] <= 0:
            res += (-b[i])//n
        else:
            res = c+1
            break
            
    if res == c:
        print('YES')
    else:

        print('NO')

# Buggy version:
n=int(input())
lis=list(map(int,input().split()))
num=(n*(n+1))//2
if sum(lis)%num!=0:
  print("NO")
  exit()
ans=0
for k in range(n):
  if -(lis[i]-lis[i-1]-sum(lis)//num)%n!=0:
    print("NO")
    exit()
  ans+=-(lis[i]-lis[i-1]-sum(lis)//num)//n
if ans == sum(lis)//num:print("YES")
else:print("NO")


# Fixed version:
n=int(input())
lis=list(map(int,input().split()))
num=(n*(n+1))//2
ll=sum(lis)
if ll%num!=0:
  print("NO")
  exit()
ans=0
for i in range(n):
  if abs(lis[i]-lis[i-1]-ll//num)%n!=0:
    print("NO")
    exit()
  ans+=abs(lis[i]-lis[i-1]-ll//num)//n
if ans == ll//num:print("YES")
else:print("NO")

# Buggy version:
N = int(input())
A = list(map(int, input().split()))

K = sum(A) // sum(range(1, N+1))
D = [A[i+1] - A[i] - K for i in range(-1, N-1)]

for d in D:
    if not (d <= 0 and d % N == 0):
        print(d)
        print("NO")
        break
else:
    print("YES")

# Fixed version:
N = int(input())
A = list(map(int, input().split()))

K = sum(A) / sum(range(1, N+1))
D = [A[i+1] - A[i] - K for i in range(-1, N-1)]
for d in D:
    if not (d <= 0 and d % N == 0):
        print("NO")
        break
else:
    print("YES")

# Buggy version:
import sys
N=int(input())
A=list(map(int,input().split()))
total=0
for i in range(N):
  total+=A[i]
if total*2/((N+1)*N)%1!=0:
  print("NO")
  sys.exit()
times=int(total*2/((N+1)*N))
if (times-A[0]+A[N-1])/N%1! or times-A[0]+A[N-1]<0=0:
  print("NO")
  sys.exit()
B=(times-A[0]+A[N-1])/N
for i in range(N-1):
  B+=(times-A[i+1]+A[i])/N
  if (times-A[i+1]+A[i])/N%1!=0 or times-A[i+1]+A[i]<0:
    print("NO")
    sys.exit()
if B==times:
  print("YES")
else:
  print("NO")

# Fixed version:
import sys
N=int(input())
A=list(map(int,input().split()))
total=0
for i in range(N):
  total+=A[i]
if total*2/((N+1)*N)%1!=0:
  print("NO")
  sys.exit()
times=int(total*2/((N+1)*N))
if (times-A[0]+A[N-1])/N%1!=0 or times-A[0]+A[N-1]<0:
  print("NO")
  sys.exit()
B=(times-A[0]+A[N-1])/N
for i in range(N-1):
  B+=(times-A[i+1]+A[i])/N
  if (times-A[i+1]+A[i])/N%1!=0 or times-A[i+1]+A[i]<0:
    print("NO")
    sys.exit()
if B==times:
  print("YES")
else:
  print("NO")

# Buggy version:
N = int(input())
A = list(map(int, input().split()))
D = [A[i + 1] - A[i] for i in range(N - 1)] + [A[0] - A[N - 1]]
k = int(sum(A) * 2 / N / (N + 1))
for d in D:
    if d - k > 0 or (d - k) % N != 0:
        print(d - k)
        print("NO")
        exit()

print("YES")


# Fixed version:
N = int(input())
A = list(map(int, input().split()))
D = [A[i + 1] - A[i] for i in range(N - 1)] + [A[0] - A[N - 1]]
k = int(sum(A) / (N * (N + 1) / 2))
if sum(A) % (N * (N + 1) / 2) != 0:
    print("NO")
    exit()

for d in D:
    if d - k > 0 or (d - k) % N != 0:
        print("NO")
        exit()

print("YES")

# Buggy version:
def main():
    N = int(input())
    A = [int(a) for a in input().rstrip().split()]
    sum_A = sum(A)
    sum_N = (N + 1) * N // 2
    if sum_A % sum_N:
        print('NO')

    ope_num = sum_A // sum_N
    diffs = [0] * N
    diffs = [r - l for l, r in zip(A[:-1], A[1:])] + [A[0] - A[-1]]
    if all([d % N and d < 0 for d in diffs]):
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()

# Fixed version:
def main():
    N = int(input())
    A = [int(a) for a in input().rstrip().split()]
    sum_A = sum(A)
    sum_N = (N + 1) * N // 2
    if sum_A % sum_N:
        print('NO')
        return

    ope_num = sum_A // sum_N
    diffs = [r - l - ope_num for l, r in zip(A[:-1], A[1:])] + [A[0] - A[-1] - ope_num]
    if all([d % N == 0 and d <= 0 for d in diffs]):
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()