March Madness - When Will Two Seeds Meet? Each March in the United States, the NCAA holds a 68-team tournament for both men's and women's college basketball. Here's what the bracket looks like:



There are four regions, each with 16 teams seeded from 1-16.

Each region is seeded the same way, and across the four regions, the same matchups occur between seeds. For example, in the first round, #1 plays #16 and #8 plays #9, then the winners of those games play in the second round. So, possible options for the second round matchup are #1 vs #8, #1 vs #9, #16 vs #8, and #16 vs #9.

Teams with the same seed can only meet in two ways: the first is in the semifinals (round 5), where the champion of each of the four regions plays another regional champion. 

The second has to do with a wrinkle in the tournament. There are also 4 "play-in" games, where two teams with the same seed play each other to enter the "true" game in the round of 64 teams. As you can see in the bracket, this only happens for seeds 11 and 16, so those seeds can play another team in the same seed in the play-in games (round 0).

The Challenge

Given two seeds from 1 to 16, inclusive, in any standard format, output the number of the earliest round a matchup between two teams with those integers as seeds could occur in the NCAA basketball tournament.

Test Cases

Input  Output
1,16   1
1,8    2
1,9    2
9,16   2
3,11   2
3,14   1
1,2    4
5,5    5
11,11  0
16,16  0
15,16  4
3,4    4
6,7    3
6,10   3
6,11   1
10,11  3
1,6    4
1,11   4
4,5    2
4,6    4
4,7    4
4,8    3
4,9    3
5,8    3
5,9    3
2,7    2


This is code-golf, so the submission with the fewest bytes wins.
Mathematica, 79 bytes

o={r=1,1}
Which[#==11o||#==16o,0,Tr@#==(c=32/2^r+1),r,0&lt;r++,#0[Min[#,c-#]&amp;/@#]]&amp;


The second line defines a pure function taking a pair of numbers as input and returning the appropriate nonnegative integer. Inside the Which (which is an "if-then-else" construct): #==11o||#==16o,0, deals with the play-in special cases; Tr@#==(c=32/2^r+1),r, checks whether the sum of the two team seeds is equal to the magic number that means they could be matched up in round r; and 0&lt;r++,#0[Min[#,c-#]&amp;/@#] is the "else" clause (since 0&lt;r++ will always be true here) which recursively calls the function on Min[#,c-#]&amp;/@#, which replaces any lower seed with the seed of the higher-ranked team it would have beaten to get to the next round.