n   = gets.to_i
ary = gets.split.map(&:to_i)

div = 2

flg = 0
cnt = 0
lst = 0
ans = 1

cnt = 0

loop do
  cnt = 0
  cnt1 = 0
  n.times do |i|
    if ary[i] < div && ary[i] != -1
      cnt1 += 1
    end
    if ary[i] % div != 0 && ary[i] != -1
      cnt += 1
      lst = i
    elsif ary[i] != -1
      ary[i] /= div
    end
  end

  if cnt1 > 1
    puts ans
    exit
  end

  if cnt == 1 && flg == 0
    ary[lst] = -1
    ans *= div
    flg = 1
  elsif cnt == n - flg
    div += 1
  elsif cnt == 0
    ans *= div
  end
end
