It took me some time to dig through the documentation but the key to solve your question is the count_members()
evaluator. I've changed your query to the following:
[out:json];
area[name="New York"]->.ny;
way(area.ny)["highway"];
foreach (
way._(if:count_members() == 50);
out geom;
);
Instead of the count(nodes)
evaluator (which will count the nodes
in the set and you have only ways
in it) you need to count the members of the ways
which you can correctly compare then. Here is my result:
And here is some more detailed view to show that the ways are added correctly and not only seen as circles: