I don't think it's sufficiently clear, from the wording of the question, what makes one ticket different from another. When I first read the question, I wondered if each train went from X to Y, but some trains stopped at A, B, C and D along the way, say, and others at only A and C.
But if there are 650 possible tickets, that interpretation doesn't make sense. Instead I gather a ticket is a direct route between two stops, so if our stops are X, A, B, C, D, ... , Y, then XA would be one ticket, AD would be another, and, since order presumably matters, DA would be yet another. So if we have n stops in total, we have n choices for the first stop on the ticket, and then n-1 choices for the destination on the ticket. We know n(n-1) = 650, and so we want two consecutive integers that multiply to 650, and those integers are 25 and 26. So we have 26 stops in total, but that includes the two stops X and Y. We're asked only how many stops are between X and Y, and we have 24 of those.