while 1:a=map(int,raw_input().split());b=[y-x for x,y in zip(a,a[1:])];print[i for i in range(21)if`b`[:-1]in`b[:i]*99`][0]