open Batteries
let () =
  let n = Scanf.scanf "%d " (fun a -> a) in

  let rec digits base n res =
    if n = 0 then res 
    else digits base (n/base) ((n mod base)::res)
  in

  Printf.printf "%d\n" @@
    List.fold_left (+) 0 (digits 10 n [])
