\displaystyle |S_n(p, a)| = \left( p - (-1)^{ \frac{p-1}{2} } \right) \sum_{b=0}^{p-1} |S_{n-2}(p, b)| + p (-1)^{ \frac{p-1}{2} } |S_{n-2}(p, a)|.