Problem solving

Why the answer is 42. In my point of view 40 is possible :

I believe you missed the part of The question Which says Each pen should be individually accessible , But the way you displayed It cannot be allocated to the squares shaped in the middle, As there is No free side to be accessible


Can yiu explain how we get 24?

I didn’t pay attention to the " each pen must be accessible to atleast one side" part. So my answer was wrong.