Base $7$ is backwards base $16$
In particular, these numbers have at most as many digits in base seven as they have in base sixteen. So, if $16^{k-1} \leq n < 16^{k}$ is such an integer, then $n$ has at most $k$ digits in base $7$, so $n < 7^k$. Thus $16^{k-1} < 7^k$. This forces $k \leq 3$. By assumption, you know that $n$ has as base-16 digits only $0,1,2,3,4,5,6$.
The one-digit numbers contribute $21$.
For the two-digit numbers: write $n$ as $ab$ in base $16$. Then $16a+b=7b+a$, so $15a=6b$ ie $5a=2b$, so $a=2,b=5$ is the only solution, ie $n=37$.
For the three-digit numbers: write $n$ as $abc$, then $256a+16b+c=49c+7b+a$, thus $255a+9b=48c$, hence $85a+3b=16c$. As $a > 0$, $c > 5$ so $c=6$ and $3|85a$, so $16c=85a+3b > 255$, so $c > 6$, impossible.
So finally it’s $21+37=58$.
If $n=a_k 16^k + \ldots + a_1 16+ a_0= a_0 7 ^k + \ldots a_{k-1}7 + a_k$, with $a_k \geq 1$, then by $n < 7^{k+1}$ we have $16 ^k < 7^{k+1}$. This means that $k\leq 3$ (can manually check this). This limits the search space considerably. Moreover, If the set of coefficients in both expansions is the same, then each $a_i \leq 6$. this makes the problem amenable to a computer search if that suffices for your purposes.
To further reduce the problem, if $a_k = 2$, then $2 \cdot 16^k \leq n < 7^{k+1}$ which gives $k\leq 2$ in this case. This should be fairly easy to code up.