BMO2 1997 - Combinatorics Find the number of polynomials of degree 5 with distinct coefficients from the set {1, 2, 3, 4, 5, 6, 7, 8} that are divisible by $x^2-x+1$. 
I tried multiplying $x^2-x+1$ by $ax^3+bx^2+cx+d$ to get $ax^5+(b-a)x^4+(a-b+c)x^3+(b-c+d)x^2+(c-d)x+d$, but I am struggling to count from here.

Filling in the details for @Gerry Myerson's answer:
WLOG assume $d>a$ and $d < b < f$. We will count the number of pairs, and multiply by $3! \cdot 2 = 12$ to account for the symmetry. Do casework on the value of $d-a$.
If $d-a = 1$, then there are $10$ possible values for $(a,d,e,b,c,f)$: 
$$(1,2,3,4,5,6), (1,2,3,4,6,7),(1,2,3,4,7,8),(1,2,4,5,6,7),(1,2,4,5,7,8)\\
(1,2,5,6,7,8),(2,3,4,5,6,7),(2,3,4,5,7,8),(2,3,5,6,7,8),(3,4,5,6,7,8) $$
If $d-a = 2$, then there are $6$ possible values for $(a,d,e,b,c,f)$:
$$ (1,3,2,4,5,7),(1,3,2,4,6,8),(1,3,4,6,5,7),(1,3,5,7,6,8),(2,4,3,5,6,8),(2,4,5,7,6,8) $$
If $d-a = 3$, then there are $4$ possible values for $(a,d,e,b,c,f)$:
$$ (1,4,2,5,3,6), (1,4,3,6,5,8), (2,5,3,6,4,7), (3,6,4,7,5,8) $$
If $d-a = 4$, then there are $4$ possible values for $(a,d,e,b,c,f)$:
$$ (1,5,2,6,3,7), (1,5,2,6,4,8), (1,5,3,7,4,8), (2,6,3,7,4,8) $$
If $d-a = 5$, there is one possible value for $(a,d,e,b,c,f)$:
$$ (1,6,2,7,3,8)$$
This gives $25$ total tuples. So there are $12 \cdot 25 = 300$ different possibilities. 

Confirmation that the answer is $300$ using a Python program: 
import itertools

def main():
  good = []
  for l in itertools.permutations(range(1,9),4):
    a = l[0]
    b_a = l[1]#b-a
    c_d = l[2]#c-d
    d = l[3]
    ambpc = c_d + d - b_a#a-b+c
    bmcpd = b_a + a - c_d#b-c+d
    if ambpc > 0 and ambpc < 9 and bmcpd > 0 and bmcpd < 9:
      if ambpc != bmcpd:
        if ambpc not in l and bmcpd not in l:
          good.append([a,b_a,ambpc,bmcpd,c_d,d])
  print(good)
  print(len(good))


if __name__=="__main__":
  main()

It works by settings the values for $a, b-a, c-d, d$ from the set $\{ 1, \cdots, 8\}$, and then seeing if the corresponding values of $a-b+c = (c-d) + d - (b-a)$ and $b-c+d = (b-a) + a - (c-d)$ are distinct and lie in the set $\{ 1, \cdots 8\}$. 
