fun main() { readLine() val a = readLine()!!.split(" ").map { it.toInt() } val result = a .sorted() .filterIndexed { index, value -> val beforeValue = a.getOrNull(index - 1) if (beforeValue == null) true else { (value - beforeValue != 1) } } .sum() println(result) }