The Altadorian Archives are the repository of all Altadorian knowledge, science, and history. Thousands of books and scrolls populate its shelves. Amongst these books is the huge, multi-volume Encyclopedia Altadoria, volumes 1 through 9950.
The archivist misplaced his shopping list inside one of the books. He has a handy way to remember which volume he placed it in, though. The volume number was a four-digit number, in which all four digits were unique. If you take the largest possible four-digit number that can be made by rearranging the four digits, and you subtract from that the smallest possible four-digit number that can be made by rearranging the four digits, the number you get is volume number, but with the digits in reverse order.
In what volume of the Encyclopedia Altadoria did he leave his shopping list?
Just use a program to crack the code.