Find all positive integers nn for which there exist non-negative integers a1,a2,,ana_1, a_2, \ldots, a_n such that 12a1+12a2++12an=13a1+23a2++n3an=1.\frac{1}{2^{a_1}} + \frac{1}{2^{a_2}} + \cdots + \frac{1}{2^{a_n}} = \frac{1}{3^{a_1}} + \frac{2}{3^{a_2}} + \cdots + \frac{n}{3^{a_n}} = 1.