#include <iostream>
#include <fstream>
using namespace std;
ifstream f("numere.in");
int main()
{
int x, y, lmax=1, l=1, amax, a, rmax, r,n;
bool ok=false;
cin>>n;
cin>>x;
while (cin>>y && n!=0)
{
if (ok=false)
{
ok=true;
l=1; a=x;
r=y-x;
}
else
{ if (y-x==r) l++;
else
{
ok=false;
if (l>lmax) lmax=l; amax=a; rmax=r;
}
}
x=y;
}
while (lmax)
{
cout<<amax<<" ";
amax=amax+r;
lmax--;
}
return 0;
}
CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPGZzdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cmlmc3RyZWFtIGYoIm51bWVyZS5pbiIpOwoKaW50IG1haW4oKQp7CiAgICBpbnQgeCwgeSwgbG1heD0xLCBsPTEsIGFtYXgsIGEsIHJtYXgsIHIsbjsKICAgIGJvb2wgb2s9ZmFsc2U7CiAgICBjaW4+Pm47CiAgICBjaW4+Png7CiAgICB3aGlsZSAoY2luPj55ICYmIG4hPTApCiAgICB7CiAgICAgICAgaWYgKG9rPWZhbHNlKQogICAgICAgIHsKICAgICAgICAgICAgb2s9dHJ1ZTsKICAgICAgICAgICAgbD0xOyBhPXg7CiAgICAgICAgICAgIHI9eS14OwogICAgICAgIH0KICAgICAgICBlbHNlCiAgICAgICAgeyBpZiAoeS14PT1yKSBsKys7CiAgICAgICAgICAgIGVsc2UgCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIG9rPWZhbHNlOwogICAgICAgICAgICAgICAgaWYgKGw+bG1heCkgbG1heD1sOyBhbWF4PWE7IHJtYXg9cjsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB4PXk7CiAgICB9CiAgICB3aGlsZSAobG1heCkKICAgIHsKICAgICAgICBjb3V0PDxhbWF4PDwiICI7CiAgICAgICAgYW1heD1hbWF4K3I7CiAgICAgICAgbG1heC0tOwogICAgfQoKICAgIHJldHVybiAwOwp9
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("numere.in");
int main()
{
int x, y, lmax=1, l=1, amax, a, rmax, r,n;
bool ok=false;
cin>>n;
cin>>x;
while (cin>>y && n!=0)
{
if (ok=false)
{
ok=true;
l=1; a=x;
r=y-x;
}
else
{ if (y-x==r) l++;
else
{
ok=false;
if (l>lmax) lmax=l; amax=a; rmax=r;
}
}
x=y;
}
while (lmax)
{
cout<<amax<<" ";
amax=amax+r;
lmax--;
}
return 0;
}