Of the 5 boxes with pencils, 2 have pens also, so $5-2=3$ have pencils only.  Similarly, $4-2 =2$ of the boxes have pens only:


[asy]
unitsize(0.05cm);
label("Pencils", (2,74));
label("Pens", (80,74));
draw(Circle((30,45), 22));
draw(Circle((58, 45), 22));
label("$2$", (44, 45));
label(scale(0.8)*"$3$",(28,58));
label(scale(0.8)*"$2$",(63,58));
[/asy]

That gives us $3+2+2=7$ boxes with pens, pencils, or both.  This leaves $10-7 = \boxed{3}$ with neither.
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
Roslyn has ten boxes. Five of the boxes contain pencils, four of the boxes contain pens, and two of the boxes contain both pens and pencils. How many boxes contain neither pens nor pencils?
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
3
Roslyn has ten boxes. Five of the boxes contain pencils, four of the boxes contain pens, and two of the boxes contain both pens and pencils. How many boxes contain neither pens nor pencils?
test