The answer is N, the length of the stick (which is 1 in this question).
The complexity is that you're being distracted by the fact that they're bumping into each other while in reality nothing happens.
So you'd have to look for the maximum distance an ant has to travel for it to fall off, which would be on either sides of the stick.