Count cyclically self-describing lists
Haskell, 75 bytes

Thanks Ørjan for saving one byte!



g n=sum[x#n|x&lt;-[1..n],let a#n=sum$[b#(n-a*b)|b&lt;-[1..n],a/=b]++[0^n^2|a==x]]


Try it online!

The problem is equivalent to:

How many ways can \$n\$ be written as \$\sum_{i=0}^ka_ia_{i+1}\$ with \$a_i\in\mathbb N,a_i\neq a_{i+1},a_0=a_k\$