N balls of equal weight and zero size sit on a straight line.
When a ball rolling right and a ball rolling left meet at the same speed, neither speed changes and the two balls only swap directions.
You are given the positions of the N balls. Hyobin picks the direction of each ball independently, right or left, each with probability 1/2. At time 0 every ball starts rolling in its chosen direction, and every ball moves 1 unit per second.
Find the expected number of collisions that happen within T seconds. A collision at exactly T seconds counts.