How do I search for (or exclude) the last nodes in ways in JOSM?

I’m using JOSM to add new sidewalks and clean up existing sidewalks in my city. I want to make sure I haven’t forgotten to tag all intersection nodes that are shared by a sidewalk and a highway as highway=crossing. I’d also like to search for other similar errors from mappers who’ve come before me.

To accomplish this, I think that I can select all untagged nodes that are shared by 2 ways where one of them is a sidewalk and the other is a street. I only want to select nodes that are neither the first nor the last node in the way.

From reading the “JOSM/Search” wiki page wiki page and the “Filter Dialog” help page, I know there is nth:1 to select the first node, or nth:-1 to select all nodes but the first, but how would I select (or exclude) all nodes but the last? Is there a nth:count or nth:max or something?

I’ve gotten this far:

type:node ways:2 untagged child highway=footway nth:-1 child (highway=* & -(highway=footway ^ highway=steps))

If I can figure out how to exclude the last nodes, I’ll be in much better shape. If anyone has a better idea or if there’s already a tool or a preset for this scenario, I’d love to know about it. Thanks in advance!

First of all, it’s zero-indexing 1st item nth:0
And is there any reason to use xor (highway=footway ^ highway=steps) ?
You seem to have a misunderstanding with nth:-1 which already selects the last. It’s negative indexing, not negating index 1. You have already used NOT in the -(highway=footway) clause. You only need to add -nth:-1

type:node 
ways:2 
untagged  
child highway=footway child (highway=* -highway=footway -highway=steps) 
-nth:-1