#include<stdio.h>

int main (){
 int N;
 int i;
  scanf("%d",&N);
  int d[N];
  for (i =0; i<N;i++){
   scanf("%d",&d[i]);
   
    d[i] *= d[i];
  }
  if (d[N-1] <1000000000000000000){
   printf("%d",d[N-1]);
  }
  else{
    printf(-1);
  }


}