I think you have 2 different ways to approach this problem. But the variable number of features and targets make it challenging. I am not aware of any well established ways to treat such issues but I find the problem interesting and would like to share my opinion.
The first way is to define this as a classification problem. The order of cars matters, in the sense that it is loss of a problem if you classify car in class 1 as a class 2, compared to identifying it as a class - say - 15 in a 20 car case. This is an "Ordinal Classification" problem and as far as I know, there is no established loss function for this. But someone implemented their own and shared it, but I never used it so I don't know how it works. Of course, this is not a must a you can use a regular classifier loss function.
Now you have to deal with variable number of cars. If you have a maximum possible number of cars present at each time, you can use that to define the number of features in your Neural Network. 946
For the cases where there are less number of cars you can set the features associated with the non-existent cars to a number (for example -1), and put a constraint to the loss function such that cars with such features are ordered after the present cars only, and drop them at the end. This might sound complicated, it certainly is so to type it here; so I hope I was able to explain it.
The second possible way is to define a clustering problem. In order to deal with variable car numbers at each case you can define the total number of cars as an additional feature. In the example you give above they all will have a car number feature = 3. And then use any clustering algorithm you can think of, such as KNN with K=max number of cars. But this also has drawbacks: When 3 cars are present, cars can be clustered as 1,2,3; but they can just as easily be clustered into 4,6,9; or even 1,1,1. And I have no idea how you would handle such an issue. Problems with the classification algorithm defined above is less likely to cause such problems, but it is much more difficult to implement.
I know these options are far from optimal so I really hope someone else comes up with a better answer. Good luck. 946