numbers = (from_json input) flip_count = 0 checksum = 0 while numbers.0 != 1 { (reverse numbers 0 numbers.0) if flip_count % 2 == 0 { checksum += flip_count } else { checksum -= flip_count } checksum += flip_count * 1 flip_count += 1 } (output numbers) (output flip_count) (output checksum)