A candidate is required to answer 7 questions out of 12 questions,which are divided into two groups,each containing 6 questions. He is not permitted to attempt more than 5 questions from either group. Find the number of different ways of doing questions.