% chardef is commonly used to store a number between 0 and 255

\chardef\x=123
\count12=\x
\the\count12

% for larger numbers, use mathchardef

\mathchardef\y=23412
\count27=\y
\the\count27

\end

