For example, for a(4)=2:
By Cayley's formula, there are 4^(4-2)=16 distinct Prüfer codes, corresponding bijectively to the 16 labeled trees on 4 vertices.
Among these, only some labelings are graceful.
We enumerate all gracefully labeled trees on 4 vertices. There are
A033472(4) = 4 in this case:
1) the star graph with the center labeled 0 and leaves labeled 1, 2 and 3. Prüfer code is (0, 0);
2) the star graph with the center labeled 3 and the leaves 0, 1 and 2. Prüfer code is (3, 3);
3) the path graph 2-1-3-0. Prüfer code is (3, 1);
4) the path graph 1-2-0-3. Prüfer code is (2, 0).
Then count how many of these Prüfer codes have the maximum label (which is 3 in this case) in the first position of the code, there are 2 such Prüfer codes: (3, 3) and (3, 1).