We add initial term S0=0 to the sequence S1,S2,…,S100 and consider all the terms Sn0<Sn1<… that are perfect squares: Snk=mk2 (in particular, n0=m0=0). Since S100=5050<722, all the numbers mk do not exceed 71. If mk+1=mk+1 the difference Snk+1−Snk=2mk+1 is odd, and an odd number must occur among the numbers ank+1,…,ank+1. There are only 50 odd numbers less than 100, so at most 50 differences mk+1−mk equal 1. If there is 61 perfect squares in the original sequence, then m61=(m61−m60)+(m60−m59)+…+(m1−m0)⩾50+11⋅2=72, a contradiction. It remains to give an example of sequence containing 60 perfect squares. Let ai=2i−1 for 1⩽i⩽50, then we use all the odd numbers and Si=i2. Further, let a51+4i=2+8i,a52+4i=100−4i,a53+4i=4+8i,a54+4i=98−4i for 0⩽i⩽7; thus we use all the even numbers between 70 and 100 and all the numbers between 2 and 60 that leave the remainder 2 or 4 when divided by 8. For 0⩽i⩽7 we have S54+4i−S50+4i=204+8i, and S54+4i=(52+2i)2. Finally, let the last 18 terms of the sequence be 30,40,64,66,68,6,8,14,16,32,38,46,54,62,22,24,48,56. This gives S87=662+2⋅134=682,S96=702.