#include <fstream>
using namespace std;
ifstream cin("perfect.in");
ofstream cout("perfect.out");
int sumDiv(int n)
{
int s = 0;
for (int i = 1; i <= n; i++)
{
if (n % i == 0)
{
s += i;
}
}
return s;
}
int main()
{
int n, max = -1, poz;
cin >> n;
for (int i = 1; i <= n; i++)
{
int x;
cin >> x;
if (sumDiv(x) == x * 2)
{
if (x > max)
{
max = x;
poz = i;
}
}
}
cin.close();
if (max == -1)
{
cout << "imposibil";
}
else
{
cout << max << " " << poz;
}
cout.close();
return 0;
}