priority encoders
The biggest problem in finding an inexpensive solution is the large number of inputs. You could do it with priority encoders, like the 74148 or CD4532B. It would take nine 8:3 line encoders and three 8-input OR gates (CD4078B).
Take the CD4532 as an example. To handle 64 inputs, you'd wire eight of them in cascade mode, using the enable-in (EI) and enable-out (EO) lines. To get the three LSBs of the binary output, you need to OR all of the D0 lines (8 ) together, all the D1 lines together, etc. For the three MSBs, you need one more 8:3 priority encoder to encode the group-select (GS) lines from the other eight encoders. Total chip count, 12.
you can also find 10:4 line priority encoders, they wouldn't make things simpler for this application.