Missile-mounted cameras You are employed as Administrator in charge of Road Maintenance and Planning. The intelligence division  of the Agency for Road Maintenance and Planning has come up with a brilliant and not at all inefficient way to take random sample pictures of the roads: missiles with cameras on them.

In this genius and not at all wasteful technique, smart non-explosive missiles are sent hurtling down each road. Each missile moves in a straight line and captures images at equal spatial intervals. Eventually the Agency will get a good overall sample of the state of affairs for each road. On Masagaki Road, for example, images are captured at positions 1, 4, 5, 6, 8, 11, 12 and 14:

1 X X 4 5 6 X 8 X X 11 12 X 14 (X represents no image)

Your job is to find the largest number of images that could have been captured by the camera on a single missile. A single camera could have captured the three images at positions 4, 5, 6 (having a spacing of 1); the three images at positions 4, 6, 8 (spacing 2); or the three images at 4, 8, 12 (spacing 4). However, here the answer is four: positions 5, 8, 11, 14 (spacing 3).

Input: a sequence of \$1\leq n\leq1000\$ unique integers, each satisfying \$1\leq i\leq1000000\$, representing the positions of the images captured for a certain road. These will be given from smallest to largest.

Output: a single integer representing the largest number of images that could have been captured by a single camera.

Sample 1

Input: 1 4 5 6 8 11 12 14

Output: 4

Sample 2

Input: 5 8 9 10 12 15 16 17

Output: 3




code-golf; the shortest code in bytes wins.
The linked rules apply.
Please explain your code.
Please link to Try It Online! or another online demo.




Inspired by 'Air Drop' (AIO 2007, Senior)
Python 2, 74 bytes



lambda l:max(reduce(lambda i,x:i+(a+i*(b-a)==x),l,0)for a in l for b in l)


Try it online!

Tries every possible sequence of the form a,b,... with a and b in the input l.

To find the smallest index i of this arithmetic progression that's outside l, we do something a bit unusual. Instead of counting up the progression to find an element not in l, we iterate over l, taking advantage of it being sorted. For each successive element x of l, we move to the next index in the arithmetic progression if its current value matches x, and stay at the current index otherwise.