import kotlin.math.max fun main() { val builder = StringBuilder() val n = readInputLine().toInt() val aArr = readInputLine().split(" ").map { it.toInt() }.toIntArray() val bArr = readInputLine().split(" ").map { it.toInt() }.toIntArray() var max = 0 var maxCnt = 0 fun dfs(phase: Int, taken: Int, score: Int) { if (phase == n) { if (score > max) { max = score maxCnt = 1 } else if (score == max) { maxCnt++ } return } for (i in 0 until n) { if (taken and (1 shl i) == 0) { dfs(phase + 1, taken or (1 shl i), score + max(0, aArr[i] - bArr[phase])) } } } dfs(0, 0, 0) builder.appendln(maxCnt) print(builder.toString()) } fun readInputLine(): String { return readLine()!! }