M = 256
EPS = 1e-10
def calc_entropy(n, arr, input)
  out = input.zip(arr).map{ |l, r| (l + r) % M }
  cnt = [0] * 256
  out.each{ |i| cnt[i] += 1 }
  cnt.map{ |i| (i / n.to_f) * (Math.log(i / n.to_f)) if i != 0 }.compact.reduce(:+) * (-1)
end

def solve(n, input)
  min = 1 << 29
  ret = []
  (0..15).each do |s|
    (0..15).each do |a|
      (0..15).each do |c|
        arr = (1..n).each_with_object([s]){ |_, arr| arr << (a * arr[-1] + c) % M }[1..-1]
        ent = calc_entropy(n, arr, input)
        if ent < min && min - ent > EPS
          ret = [s, a, c]
          min = ent
        end
      end
    end
  end
  ret
end

loop do
  n = gets.to_i
  break if n == 0
  input = gets.split.map(&:to_i)
  puts solve(n, input) * ' '
end