import sys


def main():
    positions = [int(word) for word in sys.stdin.read().strip().split(",")]

    print(
        min(
            sum(abs(b - a) for a in positions)
            for b in range(min(positions), max(positions) + 1)
        )
    )

    print(
        min(
            sum(abs(b - a) * (abs(b - a) + 1) // 2 for a in positions)
            for b in range(min(positions), max(positions) + 1)
        )
    )


if __name__ == "__main__":
    main()
