There is a hint on the right which means that the number on the box corresponds to the number of lines it is connected with. Since the lines are already given in the puzzle you have to match the right numbers with them. So starting from the top left, the number required is 2. Then 4 comes directly below it. 5 is at the centre, while 1 is directly below it. 3 will come to the right of 5 and 1 should be input directly above it.
Once you enter the numbers a key will be revealed. You can use it to unlock the door and escape.