Hi Chihiro ,
I'm not sure exactly how many combinations, but the combination of first and last, so to simplify it
=COUNTIFS(A10:A110,A1,B10:B110,B1,C10:C110,C1,D10:D110,D1)
=COUNTIFS(D10:D110,A1,E10:E110,B1,F10:F110,C1,G10:G110,D1)
If I'm not mistaken, a total of 35 combinations.
Thank you !