import java.util.Scanner object Problem237 { // 10^9なのでこれ以上は不要 val m = (0 to 30).map(Math.pow(2, _)) val fel = Seq[Int](3, 5, 17, 257, 65537) def main(args: Array[String]) { val sc = new Scanner(System.in) val a = sc.nextInt // 2^m * product(nC0〜nCn) val canConstructionFigures = { for { i <- 0 to fel.length c <- fel.combinations(i) t <- m } yield { c.product * t } } val result = canConstructionFigures.filter(n => 3 <= n && n <= a).size println(result) } }