Case #1: 0 Case #2: 1 Case #3: -1 Case #4: -1 Case #5: 6 Case #6: -1 Case #7: 7 Case #8: 2