As each location is checked, they will mark it on their list with a star. They figure that the Chief Historian should be in one of the first fifty places they'll search, so to save Christmas, you must help them get fifty stars on their list before Santa takes off on December 25th.
Collect stars by solving puzzles. There will be two puzzles available each day of the Advent calendar; The second puzzle is unlocked when you complete the first. Each puzzle awards one star. Good luck!
You haven't even left yet and the group of senior elven historians has already run into a problem: their list of locations to check is currently empty. Finally, someone decides that the best place to check it out first would be the Chief Historian's office.
Upon entering the office, everyone confirms that the Chief Historian is nowhere to be found. Instead, the Elves discover a variety of notes and lists of places of historical importance! This appears to be the planning the Chief Historian was doing before he left. Perhaps these notes can be used to determine which locations to search?
Throughout the Chief's office, locations of historical significance are listed not by name but by a unique number called a location ID. To make sure they didn't miss anything, The Historians split into two groups, each searching the office and attempting to create their own complete list of location IDs.
There's only one problem: by holding the two lists side by side (the puzzle entry), it quickly becomes clear that the lists are not very similar. Perhaps you can help the Historians reconcile their lists?
For example:
3 4
4 3
2 5
1 3
3 9
3 3
Maybe the lists are only off by a small amount! To find out, match the numbers and measure how far apart they are. Match the smallest number in the list on the left with the smallest number in the list on the right, then the second smallest number on the left with the second smallest number on the right, and so on.
Within each pair, calculate how far apart the two numbers are; you will need to add all those distances. For example, if you pair a 3 from the list on the left with a 7 from the list on the right, the distance between them is 4; If you pair a 9 with a 3, the distance between them is 6.
In the example list above, the pairs and distances would be as follows:
The smallest number in the left list is 1 and the smallest number in the right list is 3. The distance between them is 2.
The second smallest number in the list on the left is 2 and the second smallest number in the list on the right is another 3. The distance between them is 1.
The third smallest number in both lists is 3, so the distance between them is 0.
The next numbers to be paired are 3 and 4, at a distance of 1.
The fifth smallest numbers in each list are 3 and 5, at a distance of 2.
Finally, the largest number in the left list is 4, while the largest number in the right list is 9; These are at a distance of 5 apart.
To find the total distance between the list on the left and the list on the right, add the distances between all the pairs you found. In the example above, this is 2 + 1 + 0 + 1 + 2 + 5, a total distance of 11!
Your actual left and right lists contain many location ids. What is the total distance between your lists?
### Solution: 1666427