let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let sum = Array.fold_left ( + ) 0 as_ in
  let ops = sum * 2 / (n * (n + 1)) in
  let xs = Array.init n @@ fun i ->
    max 0 (as_.(i) - as_.((i + 1) mod n) + ops) / n in
  print_endline @@
  if
    sum * 2 mod (n * (n + 1)) = 0 &&
    Array.fold_left ( + ) 0 xs = ops
  then "YES" else "NO"

