Solution:
Fredek returned at least 32 times.
Assume Fredek returned k times, i.e. he was saying goodbye k+1 times to his friends. There exists a friend of Fredek, call him X13, about whom Fredek forgot k times in a row, starting from the very first time—otherwise Fredek would have come back less than k times.
Consider the remaining friends of Fredek: X1,X2,…,X12. Assume that Fredek forgot xj times about each friend Xj. Since Fredek forgot a different number of times about each of his friends, we can assume without loss of generality that xj⩾j−1 for j=1,2,…,12. Since X13 was forgotten by Fredek k times, and since Fredek forgot about exactly three of his friends each time, we have
3(k+1)=x1+x2+x3+…+x12+k⩾⩾0+1+2+3+…+11+k==66+k.
Therefore 2k⩾63, which gives k⩾32.
It is possible that Fredek returned 32 times, i.e. he was saying goodbye 33 times to his friends. The following table shows this. The i-th column displays the three friends Fredek forgot while saying goodbye for the i-th time (i.e. before his i-th return). For simplicity we write j in place of Xj.

