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
  print_endline @@ try
    if 0 < sum * 2 mod (n * (n + 1)) then raise Not_found;
    let ops = sum * 2 / (n * (n + 1)) in
    let xs = Array.init n @@ fun i ->
      let d = as_.(i) - as_.((i + 1) mod n) + ops in
      if d < 0 || 0 < d mod n then raise Not_found; d / n in
    if Array.fold_left ( + ) 0 xs <> ops then raise Not_found;
    "YES"
  with Not_found -> "NO"
