table = [] 30.times{|m| 32.times{|f| n = (2 ** m) * (2 * f[0] + 1) * (4 * f[1] + 1) * (16 * f[2] + 1) * (256 * f[3] + 1) * (65536 * f[4] + 1) table.push(n) if n >= 3 && n <= 1000000000 } } a = gets.to_i table.push(a) table.sort! p table.rindex(a)