A confusing number is a number that, when rotated 180 degrees, produces a valid yet different number.
Digits can be rotated 180 degrees according to the following rules:
The digits 0, 1, 6, 8, and 9 become 0, 1, 9, 8, and 6 respectively when rotated.
The digits 2, 3, ...