Bunuel
We can calculate each way and find the answer.
Let us check the last two digits pair wise
1) 4 and 5 : Sum =9
The first 3 digits can be anything => 3!*2=12
3! For first three digits and 2 for two ways in which 4 and 5 can be placed.
2) 3 and 5 : Sum =8
The first 3 digits can be anything => 3!*2=12
3! For first three digits and 2 for two ways in which 3 and 5 can be placed.
3) 2 and 5 : Sum =7
The first 2 digits can be 1 and 3 or 1 and 4=> 2(2!*2)=8
2! for ways within the first 2 digits and 2 for two ways in which 2 and 5 can be placed and for two sets of number 1&3 and 1&4
4) 1 and 5 : Sum =6
The first 2 digits can be 2 and 3 => (2!*2)=4
2! for ways within the first 2 digits and 2 for two ways in which 1 and 5 can be placed
5) 3 and 4 : Sum =7
The first 2 digits can be 1 and 2 or 1 and 5 => 2(2!*2)=8
2! for ways within the first 2 digits and 2 for two ways in which 3 and 4 can be placed and for two sets of number 1&2 and 1&5
6) 2 and 4 : Sum =6
The first 2 digits can be 1 and 3 => (2!*2)=4
2! for ways within the first 2 digits and 2 for two ways in which 2 and 4 can be placed
Total : 12+12+8+4+8+4=48
C