Two case:
Case 1: The 6th (last) digit is 3
Choose the 6th digit 1 way, {3}
Choose the 1st digit any of 3 ways, {5,6,7}
Choose the 2nd digit any of the remaining 4 digits
Choose the 3rd digit any of the remaining 3 digits
Choose the 4th digit either of the remaining 2 digits
Choose the 5th digit as the 1 remaining digit.
That's 1*3*4*3*2*1 = 72 ways
====================
Case 2: The 6th (last) digit is 5 or 7
Choose the 6th digit 2 ways, {5,7}
Choose the 1st digit either of 2 ways, {whichever two of {5,6,7} that remain.
Choose the 2nd digit any of the remaining 4 digits
Choose the 3rd digit any of the remaining 3 digits
Choose the 4th digit either of the remaining 2 digits
Choose the 5th digit as the 1 remaining digit.
That's 2*2*4*3*2*1 = 96 ways
================
Total for the two cases = 72 + 96 = 168
Edwin