A young boy John is playing with eight triangular panels. These panels are all regular triangles of the same size, each painted in a single color; John is forming various octahedra with them.

While he enjoys his playing, his father is wondering how many octahedra can be made of these panels since he is a pseudo-mathematician. Your task is to help his father: write a program that reports the number of possible octahedra for given panels. Here, a pair of octahedra should be considered identical when they have the same combination of the colors allowing rotation.

The input consists of multiple datasets. Each dataset has the following format:

*Color*_{1} *Color*_{2} ... *Color*_{8}

Each *Color _{i}* (1 ≤

The input ends with EOF.

For each dataset, output the number of different octahedra that can be made of given panels.

blue blue blue blue blue blue blue blue red blue blue blue blue blue blue blue red red blue blue blue blue blue blue

1 1 3

Source: ACM-ICPC Japan Alumni Group Summer Camp 2009
, Day 3, Tokyo, Japan, 2009-09-20

http://acm-icpc.aitea.net/

http://acm-icpc.aitea.net/