M = 256
while (n = gets.to_i) != 0 do
  l = gets.split.map(&:to_i)
  min = Float::INFINITY
  for s in 0..15 do
    for a in 0..15 do
      for c in 0..15 do
        o = Hash.new(0.0)
        r = s
        for i in 1..n do
          r = (a * r + c) % M
          o[(l[i - 1] + r) % M] += 1.0
        end
        h = -(o.inject(0.0){|sum, (key, x)| sum += x / n.to_f * Math::log(x / n.to_f)})
        next if min <= h
        min = h
        answer = [s, a, c]
      end
    end
  end
  puts answer.join(" ")
end