Conditional validation of checkboxes based on response

I have multiple checkbox-questions that need to have exactly that amount of checked boxes as given in a multiple-choice question. So if a person chooses, 2 in the multiple choice, I want that person to choose 2 options in the following checkbox questions.

Is this possible?