print_endline @@ Scanf.scanf "%d" @@ fun n ->
  let u = n*(n+1)/2 in
  let a = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  if n = 1 then "YES" else
  let l = Array.fold_left min 101010101010 a / u * u in
  let a = Array.map (fun v -> v - l) a in
  let s = Array.fold_left (+) 0 a in
  if s mod u <> 0 then "NO" else
  let m = s / u in
  let chk d = let k = max 0 ((d+n-2)/(n-1)) in k*(n-1) - d = m-k in
  let ok =
    Array.init n (fun i -> chk (a.(i) - a.((i+1) mod n)))
    |> Array.fold_left (&&) true
  in if ok then "YES" else "NO"