import itertools
import sys

def rec(a, c, k, s, lv, li):
  if (s == 0) and (c[0] == c[1]) and (c[2] == c[3]):
    r = c[0] * c[2]
    if r > 0:
      global x, y
      x = min(x, r)
      y = max(y, r)
    return
  u, v = abs(c[0] - c[1]), abs(c[2]-c[3])
  if (u > s) or (v > s) or ((u >= s) and (v >= s)):
    return
  z = a[k]
  si = 0
  if z == lv:
    si = li
  for i in range(si, 4):
    if (i == 1) and (c[0] == 0):
      continue
    if (i == 3) and (c[2] == 0):
      continue
    c[i] += z
    rec(a, c, k + 1, s - z, z, i)
    c[i] -= z
it = iter([i for s in map(str.split, sys.stdin.readlines()) for i in map(int, s)])
n = next(it)
_a = list(itertools.islice(it, n))
a = _a * 2
a.sort(reverse = True)
l = sum(a)
x, y = l * l + 1, 0
rec(a, [0] * 4, 0, l, 0, -1)
sys.stdout.write(f'{x} {y}\n')
