fork download
  1. n = int(input())
  2. a = list(map(int, input().split()))
  3. a.sort()
  4. max = -float('inf')
  5. for i in range(n):
  6. for j in range(i+1, n):
  7. f = a[i] * a[j]
  8. if f >= max:
  9. max = f
  10. print(max)
  11.  
Success #stdin #stdout 0.03s 9728KB
stdin
2
-1000 1000
stdout
-1000000