Valera the Horse is going to the party with friends. He has been following the fashion trends for a while, and he knows that it is very popular to wear all horseshoes of different color. Valera has got four horseshoes left from the last year, but maybe some of them have the same color. In this case he needs to go to the store and buy some few more horseshoes, not to lose face in front of his stylish comrades.Fortunately, the store sells horseshoes of all colors under the sun and Valera has enough money to buy any four of them. However, in order to save the money, he would like to spend as little money as possible, so you need to help Valera and determine what is the minimum number of horseshoes he needs to buy to wear four horseshoes of different colors to a party.

The first line contains four space-separated integers s1, s2, s3, s4 (1 ≤ s1, s2, s3, s4 ≤ 109) — the colors of horseshoes Valera has. Consider all possible colors indexed with integers.

Print a single integer — the minimum number of horseshoes Valera needs to buy.

import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    var set = HashSet<Int>()
    for(i in 0..3)
        set.add(sc.nextInt())
    print(4 - set.size)
}

fun main() = (4 - hashSetOf<String>().apply { addAll(readLine()!!.split(" ")) }.size).run(::println)

    fun main(args: Array<String>) {
        readLine()!!.split(" ").map { it.toInt()}.let {
            println(it.size - it.toSet().size)}

    }

import java.io.*
import java.util.*

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val input = InputReader(inputStream)
    val output = PrintWriter(outputStream)
    val solver = Task()
    solver.solve(input, output)
    output.close()
}

private class Task {
    fun solve(input: InputReader, output: PrintWriter) {
        readLine()!!.split(" ").map { it.toInt() }.toSet().count().let { output.println(4 - it) }
    }
}

private class InputReader(stream: InputStream) {
    private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer? = null

    operator fun next(): String {
        while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextInt(): Int {
        return next().toInt()
    }

}

/* https://codeforces.com/problemset/problem/228/A */

fun main() {
    println(4 - readLine()!!.split(" ").toSet().size)
}

fun main() {
    val count = readLine()!!.split(" ")
        .map(Integer::parseInt)
        .distinct()
        .count()

    println(4 - count)
}

import java.util.*

fun main(args: Array<String>) {
    val shoes = Scanner(System.`in`).nextLine().split(" ").map{it.toInt()}
    val distinct = HashSet<Int>()
    var ans = 0

    for(i in shoes.indices) {
        if(distinct.contains(shoes[i])) {
            ans++
        }
        else {
            distinct.add(shoes[i])
        }
    }

    println(ans)
}

fun main(args: Array<String>) {
    val shoes = HashSet<Int>(readLine()?.split(" ")?.map{it.toInt()})
    println(4 - shoes.size)
}

import java.util.*

fun main(args: Array<String>) {
    val shoes = Scanner(System.`in`).nextLine().split(" ").map{it.toInt()}
    val distinct = HashSet<Int>()

    for(i in shoes.indices) {
        distinct.add(shoes[i])
    }

    println(4 - distinct.size)
}

fun main(){
    var set = readLine()!!.split(" ").toSet()
    println(4 - set.size)
}

fun main(args: Array<String>) {
    val a = readInts().toSet().size
    print("${4 - a}")
}

private fun readInts() = readLine()!!.split(" ").map { it.toInt() }

import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val s = br.readLine().split(" ").map { it.toInt() }
    println(s.size - s.toSet().size)
}

import java.util.*

fun main() {
    val reader = Scanner(System.`in`)
    val t = reader.nextLine().split(" ").toSet()
    println(4-t.size)
}

fun readLn() = readLine()!! // string line
fun readInt() = readLn().toInt() // single int
fun readStrings() = readLn().split(" ") // list of strings
fun readInts() = readStrings().map { it.toInt() } // list of ints

fun findMinNumberOfShoes(): Int {

    val colorsHas = readInts().toSet()
    return 4 - colorsHas.size
}

fun main() {
    print(findMinNumberOfShoes())
}

fun main(args: Array<String>) {
    val p = readLine()!!.split(' ').map { it.toInt() }
    println(4 - p.toSet().size)
}

import java.util.*

fun main(){

    val scan = Scanner(System.`in`)
    val arr = Array<Int>(4){ _ -> scan.nextInt()}
    var count = 1

    for (i in 0 until 3){
        var isUnique = true

        for (j in i+1 until 4){
            if (arr[i] == arr[j]){
                isUnique = false
                break
            }
        }

        if (isUnique) count++
    }

    print(4-count)

}

fun main() {
 var colors : Set<Int> = readLine()!!.split(' ').map { it.toInt() }.toSet();
    println(4 - colors.size)
}

fun main() {
    println(4 - readLine()!!.split(" ").map { it.toInt() }.toSet().size)
}

import java.lang.AssertionError
import java.util.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

private fun myAssert(x: Boolean) {
    if (!x) {
        throw AssertionError()
    }
}

fun main(args: Array<String>) {
//  var s = Scanner(System.`in`)
  var lst = readInts().sorted()
  var ans = 0
  for (i in 1 until lst.size) {
    if (lst[i - 1] == lst[i])
      ans++
  }
  println(ans)
}

fun main() {
    println(4 - readLine()!!.split(" ").toMutableSet().size)
}

import kotlin.math.abs

fun main() {
    val read = readLine()!!.split(" ").map { it.toInt() }
    val distinct  = read.distinct()
    print(abs(distinct.size-read.size))
}

fun main(args: Array<String>) {
    val S: MutableSet<Int> = mutableSetOf()
    readLine()!!.split(' ').map(String::toInt).forEach {
        S.add(it)
    }
    val ans = 4 - S.size.toInt()
    print("$ans\n")
}

fun main(args: Array<String>) {
    println(4 - readLine()!!.split(' ').toSet().size)
}

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

fun main() {
    val shoes = readInts()

    println(4 - shoes.distinct().size)
}

fun main(args: Array<String>) {
    println(4 - readLine()!!.split(' ').map { it.toInt() }.toSet().size)
}

/* template start */
// input
private fun readString() = readLine()!!
private fun readStrings() = readString().split(" ")
private fun readInt() = readString().toInt()
private fun readDigits() = readString().map { it - '0' }
private fun readInts() = readStrings().map { it.toInt() }
private fun readLongs() = readStrings().map { it.toLong() }

// output
private fun <T> T.print(map: (T) -> String = { it.toString() }) = println(map(this))
private fun <T> Iterable<T>.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)
private fun <T> Array<T>.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)
private fun IntArray.print(sep: String? = null, map: ((Int) -> String)? = null) = asSequence().print(sep, map)
private fun <T> Sequence<T>.print(sep: String? = null, map: ((T) -> String)? = null) =
    println(joinToString(sep ?: "", transform = map ?: { it.toString() }))

// others
private val Int.isEven: Boolean get() = this % 2 == 0
private val Int.isOdd: Boolean get() = !this.isEven
private fun queries(block: (Int) -> Unit) = repeat(readInt(), block)

/* template end */

fun main() {
    val n = readInts()
    println(n.size - n.toSet().size)
}

import java.io.*
import java.util.*

class ProblemIO(val rd: BufferedReader, val wr: PrintWriter) {
    var tok = StringTokenizer("")

    companion object {
        fun console() = ProblemIO(BufferedReader(InputStreamReader(System.`in`)), PrintWriter(System.out))
        fun files(inputFilename: String, outputFilename: String) =
                ProblemIO(BufferedReader(FileReader(File(inputFilename))), PrintWriter(File(outputFilename)))
    }

    fun readToken(): String {
        while (!tok.hasMoreTokens()) {
            tok = StringTokenizer(rd.readLine())
        }
        return tok.nextToken()
    }

    fun readInt(): Int = readToken().toInt()
    fun <T> print(v: T) = wr.print(v)
    fun <T> println(v: T) = wr.println(v)
    fun close() {
        rd.close()
        wr.close()
    }
}

fun solve() {
    val io = ProblemIO.console()
    val a = IntArray(4)
    for (i in a.indices) {
        a[i] = io.readInt()
    }
    val res = 4 - a.toSet().size
    io.println(res)
    io.close()
}

fun main(args: Array<String>) {
    Thread({ solve() }).start()
}

fun main()
{
    val has = readLine()!!.split(" ").map { it.toInt() }.toSet().size
    println( 4 - has)

}

fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()

    val l = r.readLine()!!.split(" ").map { it.toInt() }.toSet()
    println(4-l.size)

}

import java.util.*
import java.math.*
import kotlin.math.*

fun readLn()=readLine()!!
fun readInt()=readLn().toInt()
fun readInts()=readLn().split(" ").map{it.toInt()}
fun readLong()=readLn().toLong()
fun readLongs()=readLn().split(" ").map{it.toLong()}

val out=mutableListOf<String>()
fun printLine(s:String){out.add(s)}
fun output(){println(out.joinToString("\n"))}

fun main(){
    var col=readInts().toIntArray()
    col.sort()
    var ans=0
    for(i in 1 until 4)if(col[i]==col[i-1])ans++
    printLine("$ans")
    output()
}

fun main() {
    val arr = readLine()!!.split(" ").distinct()
    print(4 - arr.size)
}

fun main() {
    val set = HashSet<Int>()
    val arr = readLine()?.split(" ")?.forEach {
        set.add(it.toInt())
    }

    print(4 - set.size)

}


Ksenia has ordinary pan scales and several weights of an equal mass. Ksenia has already put some weights on the scales, while other weights are untouched. Ksenia is now wondering whether it is possible to put all the remaining weights on the scales so that the scales were in equilibrium. The scales is in equilibrium if the total sum of weights on the left pan is equal to the total sum of weights on the right pan.

The first line has a non-empty sequence of characters describing the scales. In this sequence, an uppercase English letter indicates a weight, and the symbol "|" indicates the delimiter (the character occurs in the sequence exactly once). All weights that are recorded in the sequence before the delimiter are initially on the left pan of the scale. All weights that are recorded in the sequence after the delimiter are initially on the right pan of the scale.  The second line contains a non-empty sequence containing uppercase English letters. Each letter indicates a weight which is not used yet.  It is guaranteed that all the English letters in the input data are different. It is guaranteed that the input does not contain any extra characters.

If you cannot put all the weights on the scales so that the scales were in equilibrium, print string "Impossible". Otherwise, print the description of the resulting scales, copy the format of the input. If there are multiple answers, print any of them.

import java.io.BufferedReader
import java.io.InputStreamReader
import java.lang.StringBuilder
import kotlin.math.abs

fun main() {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val scales = br.readLine().split("|")
    val notUsed = br.readLine()
    val left = scales[0].length
    val right = scales[1].length
    val missing = abs(left - right)
    if (notUsed.length >= missing && (notUsed.length - missing) % 2 == 0) {
        val useToComplete = notUsed.substring(0 until missing)
        val rest = notUsed.substring(missing)
        val rest1 = rest.substring(0 until rest.length/2)
        val rest2 = rest.substring(rest.length/2)
        val newLeft = StringBuilder(scales[0])
        val newRight = StringBuilder(scales[1])
        if (left < right) {
            newLeft.append(useToComplete + rest1)
            newRight.append(rest2)
        } else {
            newLeft.append(rest1)
            newRight.append(useToComplete + rest2)
        }
        println("$newLeft|$newRight")
    } else {
        println("Impossible")
    }
}

fun main() {
    val scale = readLine()!!
    val middle = scale.indexOf('|')
    val left = scale.substring(0, middle)
    val right = scale.substring(middle + 1)
    val (smaller, bigger) = if (left.length <= right.length) left to right else right to left
    val other = readLine()!!
    if ((smaller.length + bigger.length + other.length) and (1) == 1) return print("Impossible")
    val half = (smaller.length + bigger.length + other.length) / 2
    if (smaller.length + other.length < half) return print("Impossible")
    val newSmaller = smaller + other.substring(0, half - smaller.length)
    val newBigger = bigger + other.substring(half - smaller.length)
    print(if (left.length <= right.length) "$newSmaller|$newBigger" else "$newBigger|$newSmaller")
}


Polycarp has $$$n$$$ coins, the value of the $$$i$$$-th coin is $$$a_i$$$. Polycarp wants to distribute all the coins between his pockets, but he cannot put two coins with the same value into the same pocket.For example, if Polycarp has got six coins represented as an array $$$a = [1, 2, 4, 3, 3, 2]$$$, he can distribute the coins into two pockets as follows: $$$[1, 2, 3], [2, 3, 4]$$$.Polycarp wants to distribute all the coins with the minimum number of used pockets. Help him to do that.

The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of coins. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 100$$$) — values of coins.

Print only one integer — the minimum number of pockets Polycarp needs to distribute all the coins so no two coins with the same value are put into the same pocket.

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
fun main(args : Array<String>) {
    Thread { run() }.start()
}

fun run() {

    val scanner = Scanner(System.`in`)
    val arr = IntArray(101)
    val n =scanner.nextInt()
    for (i in 0 until n) {
        val a = scanner.nextInt()
        arr[a]++
    }
    println(arr.max())

}

class Scanner(s: InputStream) {
    var st: StringTokenizer? = null
    var br: BufferedReader = BufferedReader(InputStreamReader(s))
    @Throws(IOException::class)
    operator fun next(): String {
        while (st == null || !st!!.hasMoreTokens())
            st = StringTokenizer(br.readLine())
        return st!!.nextToken()
    }
    @Throws(IOException::class)
    fun nextInt(): Int {
        return Integer.parseInt(next())
    }
    @Throws(IOException::class)
    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }
    @Throws(IOException::class)
    fun nextLine(): String {
        return br.readLine()
    }
    @Throws(IOException::class)
    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }
    @Throws(IOException::class)
    fun ready(): Boolean {
        return br.ready()
    }
}
fun IntArray.print() {
    println(Arrays.toString(this))
}
fun Array<IntArray>.print() {
    for (i in this)
        i.print()
}
fun LongArray.print() {
    println(Arrays.toString(this))
}
fun Array<LongArray>.print() {
    for (i in this)
        i.print()
}
fun BooleanArray.print() {
    println(Arrays.toString(this))
}
fun nod(a: Long, b: Long): Long {
    var a1 = a
    var b1 = b
    while (a1 != 0L && b1 != 0L) {
        if (a1 < b1)
            b1 %= a1
        else
            a1 %= b1
    }
    return a1 + b1
}
fun nok(a: Long, b: Long): Long = a * b / nod(a, b)
fun min(a: Char, b: Char): Int {
    if (a < b)
        return a.toInt()
    return b.toInt()
}
fun max(a: Char, b: Char): Int {
    if (a > b)
        return a.toInt()
    return b.toInt()
}

import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val costs = Array(101, { 0 })
    for (i in 1..n) {
        costs[sc.nextInt()] += 1
    }
    println(costs.max())
}

fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()

    val n = r.readLine()!!.toInt()
    val v = r.readLine()!!.split(" ").map { it.toInt() }.groupBy { it }.map { (k, v) -> v.size }.max()
    println(v)
}

import java.io.*
import java.util.*
import kotlin.math.max

fun solve() {

    val n = nextInt()
    val a = nextArray(n)

    var ans = 0
    for (i in 1..100) {
        ans = max(a.count { it == i }, ans)
    }

    println(ans)
}

fun hasNext() : Boolean {
    while (!st.hasMoreTokens()) {
        st = StringTokenizer(input.readLine() ?: return false)
    }
    return true
}

fun next() = if (hasNext()) st.nextToken()!! else throw RuntimeException("No tokens")

fun nextInt() = next().toInt()

fun nextLong() = next().toLong()

fun nextDouble() = next().toDouble()

fun nextLine() = if (hasNext()) st.nextToken("\n")!! else throw RuntimeException("No tokens")

fun nextArray(n : Int) = IntArray(n, { nextInt() })

val ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null

var input = when(ONLINE_JUDGE) {
    true -> BufferedReader(InputStreamReader(System.`in`), 32768)
    else -> BufferedReader(FileReader("in.txt"))
}

var output = when(ONLINE_JUDGE) {
    true -> PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))
    else -> PrintWriter(BufferedWriter(FileWriter("out.txt")))
}

var st = StringTokenizer("")

fun main(args: Array<String>) {
    val start = System.currentTimeMillis()
    solve()

    output.close()
    input.close()

    if (!ONLINE_JUDGE) {
        System.err.println("${System.currentTimeMillis() - start} ms")
    }
}

import java.util.*

fun main(args: Array<String>) {
  val input = Scanner(System.`in`)

  val coinsCount = input.nextLine()
  val coins = input.nextLine().split(" ").map { it.toInt() }
  val pocketsSet = mutableMapOf<Int, Int>()

  var max = 0

  coins.forEach {
    val coinPrice = (pocketsSet[it] ?: 0) + 1

    max = Math.max(max, coinPrice)

    pocketsSet[it] = coinPrice
  }

  println(max)
}

fun main(arg: Array<String>){
    val coinCount = readLine()!!.toInt()
    val coins = readLine()!!.split(' ').map{it.toInt()}

    var map = HashMap<Int, Int>()
    for(coin in coins) {
        val count = map[coin] ?: 0
        map[coin] = count + 1
       // System.out.print("${d}\n")
    }

    System.out.print("${map.values.max()}")
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val values = readLine()!!.split(' ').map(kotlin.String::toInt)

    val counts = mutableListOf<Int>()

    values.forEach {value ->
        counts.add(values.count { it == value })
    }

    val max = counts.max()

    print(max)
}

/* http://codeforces.com/problemset/problem/1003/A */

fun main() {
    readLine() // skip first line
    val counts = IntArray(101) { 0 }
    val coins = readLine()!!.split(" ").map { it.toInt() }
    coins.forEach { counts[it] += 1 }
    println(counts.max())
}

fun main() {
    val n = readLine()!!.toInt()
    var num = readLine()!!.split(' ').map { it.toInt() }.toIntArray()
    var count = Array(100){0}
    for (i in num){
        count[i-1]++
    }
    var max = 0
    for ( i in count )
        max = if (i > max) i else max
    print(max)
}

import java.lang.Math.max
import java.lang.Math.min
import java.util.*

//TODO: Search reduce...
/*
 SPREAD operator (*values)

* */
fun main(args: Array<String>) {
    var coin:Int
    var coins = IntArray(101){ _->0}
    val reader = Scanner(System.`in`)
    val numOfCoins = reader.nextInt()
    for (index in 1..numOfCoins) {
        coin = reader.nextInt()
        ++coins[coin]
    }
    val maxPocket = coins.max()
    println(maxPocket)
}

import java.util.*
fun main(args:Array<String>){
val sc = Scanner(System.`in`)
val n = sc.nextInt()
val cost = Array(101,{0})
for(i in 1..n)
    cost[sc.nextInt()]++
println(cost.max())
}

import java.util.*
fun main(args: Array<String>)
{
    val n = readLine()!!.toInt()
    val coins = readLine()!!.split(' ').map(String::toInt).toIntArray()
    val cnt = Array(100,{i-> coins.count{coin -> coin == i+1}})
    println(cnt.max())
}

fun main(args: Array<String>)
{
    val n = readLine()!!.toInt()
    val coins = readLine()!!.split(' ').map(String::toInt).toIntArray()
    val count = Array(100, {i -> coins.count {coin -> coin == i + 1}})
    val ans = count.max()
    println(ans)
}

fun main(args: Array<String>) {
    if (args.isNotEmpty() && args[0] == "debug") {
        System.setIn(object {}.javaClass.getResourceAsStream("/input.txt"))
    }

    solve()
}

fun getIntString() = readLine()!!
        .split(' ')
        .map { Integer.parseInt(it) }
        .toCollection(ArrayList())

fun solve() {
    val n = getIntString()[0]
    val coins = getIntString()

    val countArr = Array(100) { 0 }
    coins.forEach { countArr[it-1]++ }
    println(countArr.max())
}

fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    readLine()
    val arr = readInts()
    val occs = IntArray(101)
    for (a in arr) occs[a]++
    print(occs.max())
}

fun readString() = readLine()!!

fun readInt() = readString().toInt()
fun readLong() = readString().toLong()

fun readIntArray() = readString().split(" ").map { it.toInt() }
fun readLongArray() = readString().split(" ").map { it.toLong() }

fun main() {
    val n = readInt()
    val arr = readIntArray()
    val res = arr.groupingBy {
        it
    }.eachCount().maxBy {
        it.value
    }!!.value
    println(res)
}

import java.util.*

fun main(args: Array<String>) = with(Scanner(System.`in`)) {
  val n = nextInt()
  val c = IntArray(101)
  for (i in 0 until n) {
    c[nextInt()]++;
  }
  print(c.max()!!)
}

import java.util.*
import kotlin.math.max

fun main(args : Array<String>) {

    val n : Int = readLine()!!.toInt()
    var map : MutableMap<Int, Int> = mutableMapOf()
    val str = readLine()!!.split(" ")

    for(i in 0 until n)
        map[str[i].toInt()] = 0

    for(i in 0 until n) {
        val t = map[str[i].toInt()]!!.toInt() + 1
        map[str[i].toInt()] = t
    }

    var ans = 0
    for(i in map)
        ans = max(ans, i.value)

    println(ans)

}

    import java.util.*

    fun main(args:Array<String>) {
        val sc = Scanner(System.`in`)
        var n = sc.nextInt()
        var coin:Array<Int> = Array(100,{0})
        for (i in 0 until n){
            coin[sc.nextInt()-1]++
        }

        print(coin.max())
    }

import java.util.*

fun main(args:Array<String>) {
    val sc = Scanner(System.`in`)
    var n = sc.nextInt()
    var coin:Array<Int> = Array(n,{0})
    for (i in 0 until n){
        coin[i] = sc.nextInt()
    }
    coin.sort()
    var max = 1
    var cons =1
    for (i in 0 until (n-1)){
        if(coin[i] == coin[i+1])
            cons++
        else
            if(cons>max)
                max = cons
    }
    if(cons>max)
        max = cons
    print(max)
}

import java.util.*

fun main(args:Array<String>) {
    val sc = Scanner(System.`in`)
    var n = sc.nextInt()
    var coin:Array<Int> = Array(n,{0})
    for (i in 0 until n){
        coin[i] = sc.nextInt()
    }
    coin.sort()
    var max = 1
    var cons =0
    for (i in 0 until (n-1)){
        if(coin[i] == coin[i+1])
            cons++
        else
            if(cons>max)
                max = cons
    }
    if(cons>max)
        max = cons
    print(max)
}


Princess Twilight went to Celestia and Luna's old castle to research the chest from the Elements of Harmony.  A sequence of positive integers bi is harmony if and only if for every two elements of the sequence their greatest common divisor equals 1. According to an ancient book, the key of the chest is a harmony sequence bi which minimizes the following expression:You are given sequence ai, help Princess Twilight to find the key.

The first line contains an integer n (1 ≤ n ≤ 100) — the number of elements of the sequences a and b. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 30).

Output the key — sequence bi that minimizes the sum described above. If there are multiple optimal sequences, you can output any of them.

@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")
@file:OptIn(ExperimentalStdlibApi::class)

import java.io.PrintWriter
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
//    val startTime = System.nanoTime()

    val numCases = 1//readInt()
    case@ for(case in 1..numCases) {
        //print("Case #$case: ")

        val k = 59

        var nPrimes = 0
        val masks = IntArray(k+1)
        for(i in 2..k) if(masks[i] == 0) {
            val bit = 1 shl nPrimes
            nPrimes++

            for(j in i..k step i) masks[j] += bit
        }

        val m = 1 shl nPrimes

        val n = readInt()
        val A = readIntArray(n)

        val V = Array(n) { IntArray(m) }
        var D = IntArray(m) { inf }
        D[0] = 0

        for(i in 0 until n) {
            val a = A[i]
            val Di = IntArray(m) { inf }
            for(b in 1..a+a-1) {
                val mask = masks[b]
                val antiMask = mask xor m-1
                var s = antiMask
                val d = abs(b - a)
                while(true) {
                    if(Di.setMin(s or mask, D[s] + d)) {
                        V[i][s or mask] = b
                    }
                    if(s == 0) break
                    s = s-1 and antiMask
                }
            }

            D = Di
        }

        val ans = IntArray(n)

        var cur = (0 until m).minByOrNull { D[it] }!!

        for(i in n-1 downTo 0) {
            ans[i] = V[i][cur]
            cur -= masks[ans[i]]
        }

        println(ans.joinToString(" "))
    }

//    iprintln("Time: ${(System.nanoTime() - startTime) / 1000000} ms")
}

const val inf = Int.MAX_VALUE / 2

fun IntArray.setMax(i: Int, v: Int) = if(v > get(i)) { set(i, v); true } else false
fun IntArray.setMin(i: Int, v: Int) = if(v < get(i)) { set(i, v); true } else false

/** IO */
//@JvmField val ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null
//const val PATH = "src/main/resources/"
//@JvmField val INPUT = File(PATH + "input.txt").inputStream()
//@JvmField val OUTPUT = File(PATH + "output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

const val _BUFFER_SIZE = 1 shl 16
@JvmField val _buffer = ByteArray(_BUFFER_SIZE)
@JvmField var _bufferPt = 0
@JvmField var _bytesRead = 0

tailrec fun readChar(): Char {
    if(_bufferPt == _bytesRead) {
        _bufferPt = 0
        _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)
    }
    return if(_bytesRead < 0) Char.MIN_VALUE
    else {
        val c = _buffer[_bufferPt++].toChar()
        if (c == '\r') readChar() else c
    }
}

/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */
fun readCharArray(n: Int, skipNext: Boolean = true): CharArray {
    val res = CharArray(n) { readChar() }
    if(skipNext) readChar()
    return res
}

fun readLine(): String? {
    var c = readChar()
    return if(c == Char.MIN_VALUE) null
    else buildString {
        while(c != '\n' && c != Char.MIN_VALUE) {
            append(c)
            c = readChar()
        }
    }
}
fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/**  sort overrides to avoid quicksort attacks */

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

inline fun <A, T> _mergeSort(a0: A, n: Int, tmp0: A, get: A.(Int) -> T, set: A.(Int, T) -> Unit, cmp: (T, T) -> Int) {
    var a = a0
    var tmp = tmp0
    var len = 1
    while(len < n) {
        var l = 0
        while(true) {
            val m = l + len
            if(m >= n) break
            val r = min(n, m + len)
            var i = l
            var j = m
            for(k in l until r) {
                if(i != m && (j == r || cmp(a.get(i), a.get(j)) <= 0)) {
                    tmp.set(k, a.get(i++))
                } else tmp.set(k, a.get(j++))
            }
            l = r
        }
        for(i in l until n) tmp.set(i, a.get(i))
        val t = a; a = tmp; tmp = t
        len += len
    }
    if(a !== a0) for(i in 0 until n) a0.set(i, tmp0.get(i))
}

inline fun IntArray.sortWith(cmp: (Int, Int) -> Int) { _mergeSort(this, size, IntArray(size), IntArray::get, IntArray::set, cmp) }
inline fun <T: Comparable<T>> IntArray.sortBy(func: (Int) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> IntArray.sortByDescending(func: (Int) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun IntArray.sort() { sortBy { it } }
fun IntArray.sortDescending() { sortByDescending { it } }

inline fun LongArray.sortWith(cmp: (Long, Long) -> Int) { _mergeSort(this, size, LongArray(size), LongArray::get, LongArray::set, cmp) }
inline fun <T: Comparable<T>> LongArray.sortBy(func: (Long) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> LongArray.sortByDescending(func: (Long) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun LongArray.sort() { sortBy { it } }
fun LongArray.sortDescending() { sortByDescending { it } }

inline fun DoubleArray.sortWith(cmp: (Double, Double) -> Int) { _mergeSort(this, size, DoubleArray(size), DoubleArray::get, DoubleArray::set, cmp) }
inline fun <T: Comparable<T>> DoubleArray.sortBy(func: (Double) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> DoubleArray.sortByDescending(func: (Double) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun DoubleArray.sort() { sortBy { it } }
fun DoubleArray.sortDescending() { sortByDescending { it } }

inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T : Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T : Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T : Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T : Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

// import preserving junk function
@Suppress("NonAsciiCharacters") fun 雪花飄飄北風嘯嘯天地一片蒼茫() { iprintln(max(1, 2)) }

fun IntArray.sumLong() = sumOf { it.toLong() }

fun IntArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun IntArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun LongArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun LongArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun DoubleArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun DoubleArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> List<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> List<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }

// max/min Kotlin 1.6 -> 1.4 shim
fun IntArray.max() = maxOf { it }
fun IntArray.min() = minOf { it }
fun LongArray.max() = maxOf { it }
fun LongArray.min() = minOf { it }
fun CharArray.max() = maxOf { it }
fun CharArray.min() = minOf { it }
fun <T : Comparable<T>> Iterable<T>.max() = maxOf { it }
fun <T : Comparable<T>> Iterable<T>.min() = minOf { it }
fun <T : Comparable<T>> Sequence<T>.max() = maxOf { it }
fun <T : Comparable<T>> Sequence<T>.min() = minOf { it }

@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")
@file:OptIn(ExperimentalStdlibApi::class)

import java.io.PrintWriter
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
//    val startTime = System.nanoTime()

    val numCases = 1//readInt()
    case@ for(case in 1..numCases) {
        //print("Case #$case: ")

        val k = 59

        var nPrimes = 0
        val masks = IntArray(k+1)
        for(i in 2..k) if(masks[i] == 0) {
            val bit = 1 shl nPrimes
            nPrimes++

            for(j in i..k step i) masks[j] += bit
        }

        val m = 1 shl nPrimes

        val n = readInt()
        val A = readIntArray(n)

        val V = Array(n) { IntArray(m) }
        var D = IntArray(m) { inf }
        D[0] = 0

        for(i in 0 until n) {
            val a = A[i]
            val Di = IntArray(m) { inf }
            for(b in 1..a+a-1) {
                val mask = masks[b]
                val antiMask = mask xor m-1
                var s = antiMask
                while(true) {
                    val d = D[s]
                    if(Di.setMin(s or mask, d + abs(b - a))) {
                        V[i][s or mask] = b
                    }
                    if(s == 0) break
                    s = s-1 and antiMask
                }
            }

            D = Di
        }

        val ans = IntArray(n)

        var cur = (0 until m).minByOrNull { D[it] }!!

        for(i in n-1 downTo 0) {
            ans[i] = V[i][cur]
            cur -= masks[ans[i]]
        }

        println(ans.joinToString(" "))
    }

//    iprintln("Time: ${(System.nanoTime() - startTime) / 1000000} ms")
}

const val inf = Int.MAX_VALUE / 2

fun IntArray.setMax(i: Int, v: Int) = if(v > get(i)) { set(i, v); true } else false
fun IntArray.setMin(i: Int, v: Int) = if(v < get(i)) { set(i, v); true } else false

/** IO */
//@JvmField val ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null
//const val PATH = "src/main/resources/"
//@JvmField val INPUT = File(PATH + "input.txt").inputStream()
//@JvmField val OUTPUT = File(PATH + "output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

const val _BUFFER_SIZE = 1 shl 16
@JvmField val _buffer = ByteArray(_BUFFER_SIZE)
@JvmField var _bufferPt = 0
@JvmField var _bytesRead = 0

tailrec fun readChar(): Char {
    if(_bufferPt == _bytesRead) {
        _bufferPt = 0
        _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)
    }
    return if(_bytesRead < 0) Char.MIN_VALUE
    else {
        val c = _buffer[_bufferPt++].toChar()
        if (c == '\r') readChar() else c
    }
}

/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */
fun readCharArray(n: Int, skipNext: Boolean = true): CharArray {
    val res = CharArray(n) { readChar() }
    if(skipNext) readChar()
    return res
}

fun readLine(): String? {
    var c = readChar()
    return if(c == Char.MIN_VALUE) null
    else buildString {
        while(c != '\n' && c != Char.MIN_VALUE) {
            append(c)
            c = readChar()
        }
    }
}
fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/**  sort overrides to avoid quicksort attacks */

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

inline fun <A, T> _mergeSort(a0: A, n: Int, tmp0: A, get: A.(Int) -> T, set: A.(Int, T) -> Unit, cmp: (T, T) -> Int) {
    var a = a0
    var tmp = tmp0
    var len = 1
    while(len < n) {
        var l = 0
        while(true) {
            val m = l + len
            if(m >= n) break
            val r = min(n, m + len)
            var i = l
            var j = m
            for(k in l until r) {
                if(i != m && (j == r || cmp(a.get(i), a.get(j)) <= 0)) {
                    tmp.set(k, a.get(i++))
                } else tmp.set(k, a.get(j++))
            }
            l = r
        }
        for(i in l until n) tmp.set(i, a.get(i))
        val t = a; a = tmp; tmp = t
        len += len
    }
    if(a !== a0) for(i in 0 until n) a0.set(i, tmp0.get(i))
}

inline fun IntArray.sortWith(cmp: (Int, Int) -> Int) { _mergeSort(this, size, IntArray(size), IntArray::get, IntArray::set, cmp) }
inline fun <T: Comparable<T>> IntArray.sortBy(func: (Int) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> IntArray.sortByDescending(func: (Int) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun IntArray.sort() { sortBy { it } }
fun IntArray.sortDescending() { sortByDescending { it } }

inline fun LongArray.sortWith(cmp: (Long, Long) -> Int) { _mergeSort(this, size, LongArray(size), LongArray::get, LongArray::set, cmp) }
inline fun <T: Comparable<T>> LongArray.sortBy(func: (Long) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> LongArray.sortByDescending(func: (Long) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun LongArray.sort() { sortBy { it } }
fun LongArray.sortDescending() { sortByDescending { it } }

inline fun DoubleArray.sortWith(cmp: (Double, Double) -> Int) { _mergeSort(this, size, DoubleArray(size), DoubleArray::get, DoubleArray::set, cmp) }
inline fun <T: Comparable<T>> DoubleArray.sortBy(func: (Double) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> DoubleArray.sortByDescending(func: (Double) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun DoubleArray.sort() { sortBy { it } }
fun DoubleArray.sortDescending() { sortByDescending { it } }

inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T : Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T : Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T : Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T : Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

// import preserving junk function
@Suppress("NonAsciiCharacters") fun 雪花飄飄北風嘯嘯天地一片蒼茫() { iprintln(max(1, 2)) }

fun IntArray.sumLong() = sumOf { it.toLong() }

fun IntArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun IntArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun LongArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun LongArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun DoubleArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun DoubleArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> List<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> List<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }

// max/min Kotlin 1.6 -> 1.4 shim
fun IntArray.max() = maxOf { it }
fun IntArray.min() = minOf { it }
fun LongArray.max() = maxOf { it }
fun LongArray.min() = minOf { it }
fun CharArray.max() = maxOf { it }
fun CharArray.min() = minOf { it }
fun <T : Comparable<T>> Iterable<T>.max() = maxOf { it }
fun <T : Comparable<T>> Iterable<T>.min() = minOf { it }
fun <T : Comparable<T>> Sequence<T>.max() = maxOf { it }
fun <T : Comparable<T>> Sequence<T>.min() = minOf { it }

@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")
@file:OptIn(ExperimentalStdlibApi::class)

import java.io.PrintWriter
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
//    val startTime = System.nanoTime()

    val numCases = 1//readInt()
    case@ for(case in 1..numCases) {
        //print("Case #$case: ")

        val k = 59

        var nPrimes = 0
        val masks = IntArray(k+1)
        for(i in 2..k) if(masks[i] == 0) {
            val bit = 1 shl nPrimes
            nPrimes++

            for(j in i..k step i) masks[j] += bit
        }

        val m = 1 shl nPrimes

        val n = readInt()
        val A = readIntArray(n)

        val V = Array(n) { IntArray(m) }
        var D = IntArray(m) { inf }
        D[0] = 0

        for(i in 0 until n) {
            val a = A[i]
            val Di = IntArray(m) { inf }
            for(b in 1..a+a-1) {
                val mask = masks[b]
                val antiMask = mask xor m-1
                var s = antiMask
                while(true) {
                    val d = D[s]
                    if(d != inf && Di.setMin(s or mask, d + abs(b - a))) {
                        V[i][s or mask] = b
                    }
                    if(s == 0) break
                    s = s-1 and antiMask
                }
            }

            for(mask in 0 until m) if(D[mask] != inf) {

            }
            D = Di
        }

        val ans = IntArray(n)

        var cur = (0 until m).minByOrNull { D[it] }!!

        for(i in n-1 downTo 0) {
            ans[i] = V[i][cur]
            cur -= masks[ans[i]]
        }

        println(ans.joinToString(" "))
    }

//    iprintln("Time: ${(System.nanoTime() - startTime) / 1000000} ms")
}

const val inf = Int.MAX_VALUE

fun IntArray.setMax(i: Int, v: Int) = if(v > get(i)) { set(i, v); true } else false
fun IntArray.setMin(i: Int, v: Int) = if(v < get(i)) { set(i, v); true } else false

/** IO */
//@JvmField val ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null
//const val PATH = "src/main/resources/"
//@JvmField val INPUT = File(PATH + "input.txt").inputStream()
//@JvmField val OUTPUT = File(PATH + "output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

const val _BUFFER_SIZE = 1 shl 16
@JvmField val _buffer = ByteArray(_BUFFER_SIZE)
@JvmField var _bufferPt = 0
@JvmField var _bytesRead = 0

tailrec fun readChar(): Char {
    if(_bufferPt == _bytesRead) {
        _bufferPt = 0
        _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)
    }
    return if(_bytesRead < 0) Char.MIN_VALUE
    else {
        val c = _buffer[_bufferPt++].toChar()
        if (c == '\r') readChar() else c
    }
}

/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */
fun readCharArray(n: Int, skipNext: Boolean = true): CharArray {
    val res = CharArray(n) { readChar() }
    if(skipNext) readChar()
    return res
}

fun readLine(): String? {
    var c = readChar()
    return if(c == Char.MIN_VALUE) null
    else buildString {
        while(c != '\n' && c != Char.MIN_VALUE) {
            append(c)
            c = readChar()
        }
    }
}
fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/**  sort overrides to avoid quicksort attacks */

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

inline fun <A, T> _mergeSort(a0: A, n: Int, tmp0: A, get: A.(Int) -> T, set: A.(Int, T) -> Unit, cmp: (T, T) -> Int) {
    var a = a0
    var tmp = tmp0
    var len = 1
    while(len < n) {
        var l = 0
        while(true) {
            val m = l + len
            if(m >= n) break
            val r = min(n, m + len)
            var i = l
            var j = m
            for(k in l until r) {
                if(i != m && (j == r || cmp(a.get(i), a.get(j)) <= 0)) {
                    tmp.set(k, a.get(i++))
                } else tmp.set(k, a.get(j++))
            }
            l = r
        }
        for(i in l until n) tmp.set(i, a.get(i))
        val t = a; a = tmp; tmp = t
        len += len
    }
    if(a !== a0) for(i in 0 until n) a0.set(i, tmp0.get(i))
}

inline fun IntArray.sortWith(cmp: (Int, Int) -> Int) { _mergeSort(this, size, IntArray(size), IntArray::get, IntArray::set, cmp) }
inline fun <T: Comparable<T>> IntArray.sortBy(func: (Int) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> IntArray.sortByDescending(func: (Int) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun IntArray.sort() { sortBy { it } }
fun IntArray.sortDescending() { sortByDescending { it } }

inline fun LongArray.sortWith(cmp: (Long, Long) -> Int) { _mergeSort(this, size, LongArray(size), LongArray::get, LongArray::set, cmp) }
inline fun <T: Comparable<T>> LongArray.sortBy(func: (Long) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> LongArray.sortByDescending(func: (Long) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun LongArray.sort() { sortBy { it } }
fun LongArray.sortDescending() { sortByDescending { it } }

inline fun DoubleArray.sortWith(cmp: (Double, Double) -> Int) { _mergeSort(this, size, DoubleArray(size), DoubleArray::get, DoubleArray::set, cmp) }
inline fun <T: Comparable<T>> DoubleArray.sortBy(func: (Double) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> DoubleArray.sortByDescending(func: (Double) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun DoubleArray.sort() { sortBy { it } }
fun DoubleArray.sortDescending() { sortByDescending { it } }

inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T : Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T : Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T : Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T : Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

// import preserving junk function
@Suppress("NonAsciiCharacters") fun 雪花飄飄北風嘯嘯天地一片蒼茫() { iprintln(max(1, 2)) }

fun IntArray.sumLong() = sumOf { it.toLong() }

fun IntArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun IntArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun LongArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun LongArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun DoubleArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun DoubleArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> List<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> List<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }

// max/min Kotlin 1.6 -> 1.4 shim
fun IntArray.max() = maxOf { it }
fun IntArray.min() = minOf { it }
fun LongArray.max() = maxOf { it }
fun LongArray.min() = minOf { it }
fun CharArray.max() = maxOf { it }
fun CharArray.min() = minOf { it }
fun <T : Comparable<T>> Iterable<T>.max() = maxOf { it }
fun <T : Comparable<T>> Iterable<T>.min() = minOf { it }
fun <T : Comparable<T>> Sequence<T>.max() = maxOf { it }
fun <T : Comparable<T>> Sequence<T>.min() = minOf { it }

@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")
@file:OptIn(ExperimentalStdlibApi::class)

import java.io.PrintWriter
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
//    val startTime = System.nanoTime()

    val numCases = 1//readInt()
    case@ for(case in 1..numCases) {
        //print("Case #$case: ")

        val k = 59

        var nPrimes = 0
        val masks = IntArray(k+1)
        for(i in 2..k) if(masks[i] == 0) {
            val bit = 1 shl nPrimes
            nPrimes++

            for(j in i..k step i) masks[j] += bit
        }

        val m = 1 shl nPrimes

        val n = readInt()
        val A = readIntArray(n)

        val V = Array(n) { IntArray(m) }
        var D = IntArray(m) { inf }
        D[0] = 0

        for(i in 0 until n) {
            val a = A[i]
            val Di = IntArray(m) { inf }
            for(mask in 0 until m) if(D[mask] != inf) {
                for(b in 1..a+a-1) if(mask and masks[b] == 0) {
                    val newMask = mask or masks[b]
                    if(Di.setMin(newMask, D[mask] + abs(b - a))) V[i][newMask] = b
                }
            }
            D = Di
        }

        val ans = IntArray(n)

        var cur = (0 until m).minByOrNull { D[it] }!!

        for(i in n-1 downTo 0) {
            ans[i] = V[i][cur]
            cur -= masks[ans[i]]
        }

        println(ans.joinToString(" "))
    }

//    iprintln("Time: ${(System.nanoTime() - startTime) / 1000000} ms")
}

const val inf = Int.MAX_VALUE

fun IntArray.setMax(i: Int, v: Int) = if(v > get(i)) { set(i, v); true } else false
fun IntArray.setMin(i: Int, v: Int) = if(v < get(i)) { set(i, v); true } else false

/** IO */
//@JvmField val ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null
//const val PATH = "src/main/resources/"
//@JvmField val INPUT = File(PATH + "input.txt").inputStream()
//@JvmField val OUTPUT = File(PATH + "output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

const val _BUFFER_SIZE = 1 shl 16
@JvmField val _buffer = ByteArray(_BUFFER_SIZE)
@JvmField var _bufferPt = 0
@JvmField var _bytesRead = 0

tailrec fun readChar(): Char {
    if(_bufferPt == _bytesRead) {
        _bufferPt = 0
        _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)
    }
    return if(_bytesRead < 0) Char.MIN_VALUE
    else {
        val c = _buffer[_bufferPt++].toChar()
        if (c == '\r') readChar() else c
    }
}

/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */
fun readCharArray(n: Int, skipNext: Boolean = true): CharArray {
    val res = CharArray(n) { readChar() }
    if(skipNext) readChar()
    return res
}

fun readLine(): String? {
    var c = readChar()
    return if(c == Char.MIN_VALUE) null
    else buildString {
        while(c != '\n' && c != Char.MIN_VALUE) {
            append(c)
            c = readChar()
        }
    }
}
fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/**  sort overrides to avoid quicksort attacks */

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

inline fun <A, T> _mergeSort(a0: A, n: Int, tmp0: A, get: A.(Int) -> T, set: A.(Int, T) -> Unit, cmp: (T, T) -> Int) {
    var a = a0
    var tmp = tmp0
    var len = 1
    while(len < n) {
        var l = 0
        while(true) {
            val m = l + len
            if(m >= n) break
            val r = min(n, m + len)
            var i = l
            var j = m
            for(k in l until r) {
                if(i != m && (j == r || cmp(a.get(i), a.get(j)) <= 0)) {
                    tmp.set(k, a.get(i++))
                } else tmp.set(k, a.get(j++))
            }
            l = r
        }
        for(i in l until n) tmp.set(i, a.get(i))
        val t = a; a = tmp; tmp = t
        len += len
    }
    if(a !== a0) for(i in 0 until n) a0.set(i, tmp0.get(i))
}

inline fun IntArray.sortWith(cmp: (Int, Int) -> Int) { _mergeSort(this, size, IntArray(size), IntArray::get, IntArray::set, cmp) }
inline fun <T: Comparable<T>> IntArray.sortBy(func: (Int) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> IntArray.sortByDescending(func: (Int) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun IntArray.sort() { sortBy { it } }
fun IntArray.sortDescending() { sortByDescending { it } }

inline fun LongArray.sortWith(cmp: (Long, Long) -> Int) { _mergeSort(this, size, LongArray(size), LongArray::get, LongArray::set, cmp) }
inline fun <T: Comparable<T>> LongArray.sortBy(func: (Long) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> LongArray.sortByDescending(func: (Long) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun LongArray.sort() { sortBy { it } }
fun LongArray.sortDescending() { sortByDescending { it } }

inline fun DoubleArray.sortWith(cmp: (Double, Double) -> Int) { _mergeSort(this, size, DoubleArray(size), DoubleArray::get, DoubleArray::set, cmp) }
inline fun <T: Comparable<T>> DoubleArray.sortBy(func: (Double) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> DoubleArray.sortByDescending(func: (Double) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun DoubleArray.sort() { sortBy { it } }
fun DoubleArray.sortDescending() { sortByDescending { it } }

inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T : Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T : Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T : Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T : Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

// import preserving junk function
@Suppress("NonAsciiCharacters") fun 雪花飄飄北風嘯嘯天地一片蒼茫() { iprintln(max(1, 2)) }

fun IntArray.sumLong() = sumOf { it.toLong() }

fun IntArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun IntArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun LongArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun LongArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun DoubleArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun DoubleArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> List<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> List<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }

// max/min Kotlin 1.6 -> 1.4 shim
fun IntArray.max() = maxOf { it }
fun IntArray.min() = minOf { it }
fun LongArray.max() = maxOf { it }
fun LongArray.min() = minOf { it }
fun CharArray.max() = maxOf { it }
fun CharArray.min() = minOf { it }
fun <T : Comparable<T>> Iterable<T>.max() = maxOf { it }
fun <T : Comparable<T>> Iterable<T>.min() = minOf { it }
fun <T : Comparable<T>> Sequence<T>.max() = maxOf { it }
fun <T : Comparable<T>> Sequence<T>.min() = minOf { it }

import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs

val PRIMES = mutableListOf(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53)
val IMPORTANT = (1..30) + listOf(31, 32, 37, 41, 43, 47, 49, 53)

fun main() {
    val jin = BufferedReader(InputStreamReader(System.`in`))
    val n = jin.readLine().toInt()
    val masks = IntArray(54)
    for (k in 1..53) {
        for (e in 0..15) {
            if (k % PRIMES[e] == 0) {
                masks[k] += 1 shl e
            }
        }
    }
    val dp = Array(n + 1) { IntArray(1 shl 16) { 115115 } }
    dp[0][0] = 0
    val used = Array(n + 1) { IntArray(1 shl 16) }
    val tokenizer = StringTokenizer(jin.readLine())
    for (j in 1..n) {
        val a = tokenizer.nextToken().toInt()
        for (k in IMPORTANT) {
            for (mask in 0 until (1 shl 16)) {
                if (mask and masks[k] == 0 && dp[j - 1][mask] + abs(k - a) < dp[j][mask or masks[k]]) {
                    dp[j][mask or masks[k]] = dp[j - 1][mask] + abs(k - a)
                    used[j][mask or masks[k]] = k
                }
            }
        }
    }
    val optimal = dp[n].min()!!
    for (mask in 0 until (1 shl 16)) {
        if (dp[n][mask] == optimal) {
            val answer = mutableListOf<Int>()
            var mask = mask
            for (j in n downTo 1) {
                answer.add(used[j][mask])
                mask -= masks[used[j][mask]]
            }
            println(answer.reversed().joinToString(" "))
            return
        }
    }
}


When the curtains are opened, a canvas unfolds outside. Kanno marvels at all the blonde colours along the riverside — not tangerines, but blossoms instead."What a pity it's already late spring," sighs Mino with regret, "one more drizzling night and they'd be gone.""But these blends are at their best, aren't they?" Absorbed in the landscape, Kanno remains optimistic. The landscape can be expressed as a row of consecutive cells, each of which either contains a flower of colour amber or buff or canary yellow, or is empty.When a flower withers, it disappears from the cell that it originally belonged to, and it spreads petals of its colour in its two neighbouring cells (or outside the field if the cell is on the side of the landscape). In case petals fall outside the given cells, they simply become invisible.You are to help Kanno determine whether it's possible that after some (possibly none or all) flowers shed their petals, at least one of the cells contains all three colours, considering both petals and flowers. Note that flowers can wither in arbitrary order.

The first and only line of input contains a non-empty string $$$s$$$ consisting of uppercase English letters 'A', 'B', 'C' and characters '.' (dots) only ($$$\lvert s \rvert \leq 100$$$) — denoting cells containing an amber flower, a buff one, a canary yellow one, and no flowers, respectively.

Output "Yes" if it's possible that all three colours appear in some cell, and "No" otherwise. You can print each letter in any case (upper or lower).

NoteIn the first example, the buff and canary yellow flowers can leave their petals in the central cell, blending all three colours in it.In the second example, it's impossible to satisfy the requirement because there is no way that amber and buff meet in any cell.

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.collections.HashMap
import kotlin.math.min

fun main(args: Array<String>)
        = Thread { run() }.start()

fun run() {

    val scanner = Scanner(System.`in`)
    val str = scanner.next()
    val arr = IntArray(102)
    for (i in 0 until str.length) {
        if (str[i] == 'A') {
            for (j in i .. i + 2) {
                arr[j] += 1
                if (arr[j] == 7) {
                    print("Yes")
                    return
                }
            }
        }
        if (str[i] == 'B') {
            for (j in i .. i + 2) {
                arr[j] += 2
                if (arr[j] == 7) {
                    print("Yes")
                    return
                }
            }
        }
        if (str[i] == 'C') {
            for (j in i .. i + 2) {
                arr[j] += 4
                if (arr[j] == 7) {
                    print("Yes")
                    return
                }
            }
        }
    }
    println("No")
}

class Scanner(s: InputStream) {
    var st: StringTokenizer? = null
    var br: BufferedReader = BufferedReader(InputStreamReader(s))
    @Throws(IOException::class)
    operator fun next(): String {
        while (st == null || !st!!.hasMoreTokens())
            st = StringTokenizer(br.readLine())
        return st!!.nextToken()
    }
    @Throws(IOException::class)
    fun nextInt(): Int {
        return Integer.parseInt(next())
    }
    @Throws(IOException::class)
    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }
    @Throws(IOException::class)
    fun nextLine(): String {
        return br.readLine()
    }
    @Throws(IOException::class)
    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }
    @Throws(IOException::class)
    fun ready(): Boolean {
        return br.ready()
    }
}
class Pair(var a: Int, var b: Int): Comparable<Pair> {
    override fun compareTo(other: Pair): Int {
        return b - a - other.b + other.a
    }
}

fun main(args: Array<String>) {
    val s = readLine()!!
    val n = s.length
    for (i in 1..n - 2  ) {
        val ss = setOf(s[i - 1], s[i], s[i + 1])
        if (!ss.contains('.') && ss.size == 3) {
            println("Yes")
            return
        }
    }
    println("No")
}

import java.io.*
import java.util.*

fun main(args: Array<String>) {
    solve(System.`in`, System.out)
}

val MAX_N = (1e6 + 10).toInt()
val INF = (1e9 + 7).toInt()
val MOD = (1e9 + 7).toInt()
val INF_F = 1e-6

fun solve(input: InputStream, output: OutputStream) {
    val reader = InputReader(BufferedInputStream(input))
    val writer = PrintWriter(BufferedOutputStream(output))

    solve(reader, writer)
    writer.close()
}

fun solve(reader: InputReader, writer: PrintWriter) {
    val s = reader.next()
    for (i in 1 until s.length - 1) {
        if (s[i - 1] == '.' || s[i] == '.' || s[i + 1] == '.') {
            continue
        }

        if (s[i - 1] != s[i] && s[i - 1] != s[i + 1] && s[i] != s[i + 1]) {
            writer.println("yes")
            return
        }
    }
    writer.println("no")
}

fun gcd(a: Int, b: Int): Int {
    return if (b == 0) a else gcd(b, a % b)
}

class InputReader(stream: InputStream) {
    private val reader = BufferedReader(InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer? = null

    operator fun next(): String {
        while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }

    fun nextArrayInt(count: Int): IntArray {
        return nextArrayInt(0, count)
    }

    fun nextArrayInt(start: Int, count: Int): IntArray {
        val a = IntArray(start + count)
        for (i in start until start + count) {
            a[i] = nextInt()
        }
        return a
    }

    fun nextArrayLong(count: Int): LongArray {
        val a = LongArray(count)
        for (i in 0 until count) {
            a[i] = nextLong()
        }
        return a
    }
}

fun main(args: Array<String>){
    val opa = readLine()!!
    var result = false
    for (i in 1..opa.length - 2){
    if (opa.get(i) != opa.get(i-1)
    && opa.get(i) != opa.get(i+1)
    && opa.get(i) != '.'
    && opa.get(i+1) != '.'
    && opa.get(i-1) != '.'
    && opa.get(i-1) != opa.get(i+1)){
        result = true
    }
    }
    if (result){
    println("Yes")
    } else {
    println("No")
    }

}

fun main() {
    val valids = setOf("ABC", "ACB", "BAC", "BCA", "CAB", "CBA")
    val s = readLine()!!
    for (start in 0..s.length - 3)
        if (s.substring(start..start + 2) in valids) return print("Yes")
    print("No")
}

fun main(args: Array<String>){
    val opa = readLine()
    if (opa == null){
    System.out.println("No")
    return
    } else {
    var result = false
    for (i in 1..opa.length - 2){
    if (opa.get(i) != opa.get(i-1)
    && opa.get(i) != opa.get(i+1)
    && opa.get(i) != '.'
    && opa.get(i+1) != '.'
    && opa.get(i-1) != '.'){
        result = true
    }
    }
    if (result){
    println("Yes")
    } else {
    println("No")
    }
    }

}


In a small but very proud high school it was decided to win ACM ICPC. This goal requires to compose as many teams of three as possible, but since there were only 6 students who wished to participate, the decision was to build exactly two teams.After practice competition, participant number i got a score of ai. Team score is defined as sum of scores of its participants. High school management is interested if it's possible to build two teams with equal scores. Your task is to answer that question.

The single line contains six integers a1, ..., a6 (0 ≤ ai ≤ 1000) — scores of the participants

Print "YES" (quotes for clarity), if it is possible to build teams with equal score, and "NO" otherwise. You can print each character either upper- or lowercase ("YeS" and "yes" are valid when the answer is "YES").

NoteIn the first sample, first team can be composed of 1st, 2nd and 6th participant, second — of 3rd, 4th and 5th: team scores are 1 + 3 + 1 = 2 + 1 + 2 = 5.In the second sample, score of participant number 6 is too high: his team score will be definitely greater.

import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.StringTokenizer

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)
    val a = Array(6) { sc.nextInt() }
    val total = a.sum()

    for (i in 0..5) {
        for (j in i + 1..5) {
            for (k in j + 1..5) {
                val s = a[i] + a[j] + a[k]
                if(s == total - s) {
                    println("YES")
                    return
                }
            }
        }
    }

    println("NO")

}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending

/** @author Om Kumar */
fun main() { _writer.solve(); _writer.flush() }

fun solve(a: IntArray): Boolean{
    val sum = a.reduce { acc, i ->  acc + i}
    if((sum and 1) == 0) {
        for (i in 0..5) {
            for (j in i + 1..5) {
                for (k in j + 1..5) {
                    if (a[i] + a[j] + a[k] == sum / 2){
                        return true
                    }
                }
            }
        }
    }
    return false
}

fun PrintWriter.solve() {
    val a = readIntArray(6)
    println(if(solve(a)) "YES" else "NO")
}

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x58359625447 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun main(args: Array<String>) {
    val mass = readLine()!!.split(" ").map { it.toInt() }
    val f = mass.sum()
    if (f % 2 != 0) {
        print("NO")
    } else {
        var stop = false
        for (i in 0..5) {
            for (j in 0..5) {
                for (k in 0..5) {
                    if (i != j && i != k && j != k && (mass[i] + mass[j] + mass[k])* 2 == f) {
                        print("YES")
                        stop = true
                        break
                    }
                }
                if (stop) {
                    break
                }
            }
            if (stop) {
                break
            }
        }
        if (!stop) {
            print("NO")
        }
    }
}

fun main() {
    var list = readLine()!!.split(' ').map { it.toInt() }.sorted().toMutableList()
//    if (list.sum() % 2 == 0) {
//        println("NO")
//        return
//    }
    var flag = false
    var midSum = list.sum() / 2
    var temp = false
    for (i in 0..4) {
        var sum = list[5] + list[i]
        for (j in 0..4) {
            if (i != j) {
                sum += list[j]
                if (sum == midSum) {
                    list[5] = 0
                    list[i] = 0
                    list[j] = 0
                    flag = true
                    temp = true
                    break
                }else{
                    sum = list[5] + list[i]
                }
            }
        }
        if (temp) break
    }
    if (flag) {
        if (list.sum() == midSum) {
            println("YES")
        } else {
            println("NO")
        }
    } else {
        println("NO")
    }

}

fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    val scores = readInts()
    if (scores.sum() and 1 == 1) return print("NO")
    val goal = scores.sum() / 2
    for (first in 0..3)
        for (second in first + 1..4)
            for (third in second + 1..5)
                if (scores[first] + scores[second] + scores[third] == goal) return print("YES")
    print("NO")
}

fun main() {
    var list = readLine()!!.split(' ').map { it.toInt() }.sorted().toMutableList()
//    if (list.sum() % 2 == 0) {
//        println("NO")
//        return
//    }
    var flag = false
    var midSum = list.sum() / 2
    var temp = false
    for (i in 0..4) {
        var sum = list[5] + list[i]
        for (j in i + 1..4) {
            sum += list[j]
            if (sum == midSum) {
                list[5] = 0
                list[i] = 0
                list[j] = 0
                flag = true
                temp = true
                break
            }
        }
        if (temp) break
    }
    if (flag) {
        if (list.sum() == midSum) {
            println("YES")
        } else {
            println("NO")
        }
    } else {
        println("NO")
    }

}

fun main() {
    var list = readLine()!!.split(' ').map { it.toInt() }.sorted()
    var flag = true
    if (list.sum() % 2 == 0) {
        if (list[0] + list[1] + list[5] != list.sum() / 2) {
            flag = false
        }
        if (list[2] + list[3] + list[4] != list.sum() / 2){
            flag = false
        }
    }else{
        println("NO")
        return
    }
    println(if (flag) "YES" else "NO")

}


Bishwock is a chess figure that consists of three squares resembling an "L-bar". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states: XX   XX   .X   X.X.   .X   XX   XX Bishwocks don't attack any squares and can even occupy on the adjacent squares as long as they don't occupy the same square. Vasya has a board with $$$2\times n$$$ squares onto which he wants to put some bishwocks. To his dismay, several squares on this board are already occupied by pawns and Vasya can't put bishwocks there. However, pawns also don't attack bishwocks and they can occupy adjacent squares peacefully.Knowing the positions of pawns on the board, help Vasya to determine the maximum amount of bishwocks he can put onto the board so that they wouldn't occupy the same squares and wouldn't occupy squares with pawns.

The input contains two nonempty strings that describe Vasya's board. Those strings contain only symbols "0" (zero) that denote the empty squares and symbols "X" (uppercase English letter) that denote the squares occupied by pawns. Strings are nonempty and are of the same length that does not exceed $$$100$$$.

Output a single integer — the maximum amount of bishwocks that can be placed onto the given board.

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.*
fun main(args: Array<String>) {

    val scanner = Scanner(System.`in`)
    val Q = Array<CharArray>(2) { scanner.next().toCharArray() }
    var res = 0
    for (i in 0..Q[0].size - 2) {
        if (Q[0][i] == '0' && Q[1][i] == '0' && Q[0][i + 1] == '0') {
            Q[0][i] = 'X'
            Q[1][i] = 'X'
            Q[0][i + 1] = 'X'
            res++
        }
        if (Q[0][i] == '0' && Q[1][i] == '0' && Q[1][i + 1] == '0') {
            Q[0][i] = 'X'
            Q[1][i] = 'X'
            Q[1][i + 1] = 'X'
            res++
        }
        if (Q[0][i] == '0' && Q[0][i + 1] == '0' && Q[1][i + 1] == '0') {
            Q[0][i] = 'X'
            Q[0][i + 1] = 'X'
            Q[1][i + 1] = 'X'
            res++
        }
        if (Q[1][i] == '0' && Q[1][i + 1] == '0' && Q[0][i + 1] == '0') {
            Q[1][i] = 'X'
            Q[1][i + 1] = 'X'
            Q[0][i + 1] = 'X'
            res++
        }
    }
    println(res)

}

class Scanner(s: InputStream) {
    var st: StringTokenizer? = null
    var br: BufferedReader = BufferedReader(InputStreamReader(s))
    @Throws(IOException::class)
    operator fun next(): String {
        while (st == null || !st!!.hasMoreTokens())
            st = StringTokenizer(br.readLine())
        return st!!.nextToken()
    }
    @Throws(IOException::class)
    fun nextInt(): Int {
        return Integer.parseInt(next())
    }
    @Throws(IOException::class)
    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }
    @Throws(IOException::class)
    fun nextLine(): String {
        return br.readLine()
    }
    @Throws(IOException::class)
    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }
    @Throws(IOException::class)
    fun ready(): Boolean {
        return br.ready()
    }
}

fun IntArray.print() {
    println(Arrays.toString(this))
}

//class Pair(var a: Int, var b: Int): Comparable<Pair> {
//    override fun compareTo(other: Pair): Int {
//        return b - a - other.b + other.a
//    }
//}

//package codeForces.c491_2

fun main(args: Array<String>) {
    val s1 = (readLine()!! + 'X').toCharArray()
    val s2 = (readLine()!! + 'X').toCharArray()

    val lenght = minOf(s1.size, s2.size)

    var count = 0
    var i = -1
    while (i < lenght - 1) {
        i++
        if (s1[i] == '0' && s2[i] == '0') {
            if (s1[i + 1] == '0') {
                s1[i + 1] = 'X'
                count++
                continue
            } else if (s2[i + 1] == '0') {
                s2[i + 1] = 'X'
                count++
                continue
            }
        }

        if (
                (s1[i] == '0' || s2[i] == '0') &&
                s1[i + 1] == '0' &&
                s2[i + 1] == '0'
        ) {
            count++
            i++
            continue
        }
    }

    print(count)
}

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.*
fun main(args: Array<String>) {

    val scanner = Scanner(System.`in`)
    val Q = Array<String>(2) { "X" + scanner.next() + "X" }
    var last = 0
    var res = 0
    for (i in 0 until Q[0].length) {
        if (Q[0][i] == 'X' && Q[1][i] == 'X') {
            if ((i - last) % 3 == 0)
                res += ((i - last) / 3) * 2
            else if ((i - last) % 3== 2)
                res += ((i - last) / 3) * 2 + 1
            else
                res += ((i - last) / 3) * 2
            last = i + 1
        }
        else if (Q[0][i] == 'X' || Q[1][i] == 'X') {
            if ((i - last) % 3 == 0)
                res += ((i - last) / 3) * 2
            else if ((last - i) % 3 == 2)
                res += ((i - last) / 3) * 2 + 1
            else
                res += (((i - last) / 3) * 2) + 1
            last = i + 1
        }
        else if (Q[0][i] == '0' && Q[1][i] == '0' && ((Q[0][i - 1] == 'X' && Q[1][i - 1] != 'X') || (Q[1][i - 1] == 'X' && Q[0][i - 1] != 'X'))) {
            res++
            last = i + 1
        }
    }
    println(res)

}

class Scanner(s: InputStream) {
    var st: StringTokenizer? = null
    var br: BufferedReader = BufferedReader(InputStreamReader(s))
    @Throws(IOException::class)
    operator fun next(): String {
        while (st == null || !st!!.hasMoreTokens())
            st = StringTokenizer(br.readLine())
        return st!!.nextToken()
    }
    @Throws(IOException::class)
    fun nextInt(): Int {
        return Integer.parseInt(next())
    }
    @Throws(IOException::class)
    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }
    @Throws(IOException::class)
    fun nextLine(): String {
        return br.readLine()
    }
    @Throws(IOException::class)
    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }
    @Throws(IOException::class)
    fun ready(): Boolean {
        return br.ready()
    }
}

fun IntArray.print() {
    println(Arrays.toString(this))
}

//class Pair(var a: Int, var b: Int): Comparable<Pair> {
//    override fun compareTo(other: Pair): Int {
//        return b - a - other.b + other.a
//    }
//}


Two players play a simple game. Each player is provided with a box with balls. First player's box contains exactly n1 balls and second player's box contains exactly n2 balls. In one move first player can take from 1 to k1 balls from his box and throw them away. Similarly, the second player can take from 1 to k2 balls from his box in his move. Players alternate turns and the first player starts the game. The one who can't make a move loses. Your task is to determine who wins if both players play optimally.

The first line contains four integers n1, n2, k1, k2. All numbers in the input are from 1 to 50. This problem doesn't have subproblems. You will get 3 points for the correct submission.

Output "First" if the first player wins and "Second" otherwise.

NoteConsider the first sample test. Each player has a box with 2 balls. The first player draws a single ball from his box in one move and the second player can either take 1 or 2 balls from his box in one move. No matter how the first player acts, the second player can always win if he plays wisely.

import java.io.*
import java.util.*

class ProblemIO(val rd: BufferedReader, val wr: PrintWriter) {
    companion object {
        fun console() = ProblemIO(BufferedReader(InputStreamReader(System.`in`)), PrintWriter(System.out))
    }

    var tok = StringTokenizer("")

    fun close() { rd.close(); wr.close() }
    fun <T> print(v: T) = wr.print(v)
    fun <T> println(v: T) = wr.println(v)
    fun readToken(): String {
        while (!tok.hasMoreTokens()) tok = StringTokenizer(rd.readLine())
        return tok.nextToken()
    }
    fun readInt() = readToken().toInt()
    fun readLong() = readToken().toLong()
    fun readLine() : String {
        tok = StringTokenizer("")
        return rd.readLine()
    }
}

fun main(args: Array<String>) {
    Thread({ val io = ProblemIO.console(); solve(io) ; io.close() }).start()
}

fun solve(io: ProblemIO) {
    val n = IntArray(2, { io.readInt() })
    val k = IntArray(2, { io.readInt() })
    val res = when {
        n[0] <= n[1] -> "Second"
        else -> "First"
    }
    io.println(res)
}

fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    //val n = r.readLine()!!.toInt()
    //var (n, m) = r.readLine()!!.split(" ").map { it.toInt() }
    val v = r.readLine()!!.split(" ").map { it.toInt() }
    println(if (v[0]-v[1]>0) "First" else "Second")
}

import java.util.Scanner

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    println(if (sc.nextInt() > sc.nextInt()) "First" else "Second")
}

import javafx.util.Pair

import java.util.ArrayList
import java.util.Scanner

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n1 = scanner.nextInt()
    val n2 = scanner.nextInt()
    println(if (n1 > n2) "First" else "Second")

}

import java.util.*

fun main(args: Array<String>) {
    var scan = Scanner(System.`in`)
    var p1 = scan.nextInt()
    var p2 = scan.nextInt()
    if (p1 > p2) {
        println("First")
    } else {
        println("Second")
    }
}

import kotlin.math.abs

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readStrings() = readLn().split(" ")
fun readInts() = readStrings().map { it.toInt() }

fun main(args: Array<String>) {
    var (n, m, k, l) = readInts()
    if (n > m) print("First") else print("Second")
}

import org.omg.PortableInterceptor.INACTIVE
import java.util.*

fun main(args: Array<String>) {
    val s = Scanner(System.`in`)
    val a = IntArray(2, { s.nextInt() })
    val b = IntArray(2, { s.nextInt() })
    val res = when {a[0] > a[1] -> "First" else -> "Second"}
    print(res)
}

fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    val (n1, n2, k1, k2) = readInts()
    print(if (n1 > n2) "First" else "Second")
}

fun main(args: Array<String>) {
    val (f,s) = readLine()!!.split(" ").map { it.toInt() }
    println(if (f > s) "First" else "Second")
}


JATC and his friend Giraffe are currently in their room, solving some problems. Giraffe has written on the board an array $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ of integers, such that $$$1 \le a_1 < a_2 < \ldots < a_n \le 10^3$$$, and then went to the bathroom.JATC decided to prank his friend by erasing some consecutive elements in the array. Since he doesn't want for the prank to go too far, he will only erase in a way, such that Giraffe can still restore the array using the information from the remaining elements. Because Giraffe has created the array, he's also aware that it's an increasing array and all the elements are integers in the range $$$[1, 10^3]$$$.JATC wonders what is the greatest number of elements he can erase?

The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array. The second line of the input contains $$$n$$$ integers $$$a_i$$$ ($$$1 \le a_1<a_2<\dots<a_n \le 10^3$$$) — the array written by Giraffe.

Print a single integer — the maximum number of consecutive elements in the array that JATC can erase. If it is impossible to erase even a single element, print $$$0$$$.

NoteIn the first example, JATC can erase the third and fourth elements, leaving the array $$$[1, 3, \_, \_, 6, 9]$$$. As you can see, there is only one way to fill in the blanks.In the second example, JATC can erase the second and the third elements. The array will become $$$[998, \_, \_]$$$. Because all the elements are less than or equal to $$$1000$$$, the array is still can be restored. Note, that he can't erase the first $$$2$$$ elements.In the third example, JATC can erase the first $$$4$$$ elements. Since all the elements are greater than or equal to $$$1$$$, Giraffe can still restore the array. Note, that he can't erase the last $$$4$$$ elements.

import kotlin.math.max

fun main() {
    readLine()
    val array = mutableListOf(0)
    array.addAll(readLine()!!.split(" ").map(String::toInt))
    array.add(1001)
    var sol = 0
    var current = 0
    for (elementPos in 1 until array.size - 1) {
        if (array[elementPos - 1] + 1 == array[elementPos] &&
            array[elementPos] + 1 == array[elementPos + 1]
        )
            current++
        else
            current = 0
        sol = max(sol, current)
    }
    print(sol)
}