For n=0, there is only one array of length 5 with coefficients in 0..0, (0,0,0,0,0), and it satisfies the requirement, so a(0) = 1.
For n=1, the six arrays of length 5 with coefficients in 0..1 which do not satisfy the requirement are {(0,1,0,1,x), (0,1,x,0,1), (x,0,1,0,1); 0 <= x <= 1}, so a(1) = 2^5 - 6 = 26. (End)
Some solutions for n=3:
2 3 1 0 0 3 3 0 0 0 0 3 2 3 2 2
2 0 3 3 2 3 3 1 2 3 0 3 3 1 0 3
1 0 2 1 1 1 3 2 3 2 3 2 0 1 2 0
0 2 0 1 0 2 2 2 1 3 3 2 2 1 3 3
2 3 0 0 0 1 1 3 1 0 1 0 1 1 1 1