I extracted vertices using 'Extract vertices' in Processing Tool. But so many unnecessary vertices extracted, so I want to remove them. What I want to leave is at the beginning and the end of the line. How can I remove those vertices in the middle of the line? I would like to know if there is a way to erase it all at once because there are so many things like that.
Vertices are in the same layer.
I want to remove all the blue vertices like the picture below.

