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")
    }
    }

}


fun main(args: Array<String>) {
    print("NO")
}

import java.io.PrintWriter
import kotlin.math.*

fun main() {
    io.apply {

        cout .. "NO" .. nl

    }.cout.flush()
}

// @formatter:off
private val io = object {
    private val `in` = System.`in`
    private fun ll(): Long {
        var x: Int; var q = false; var n = 0L; do x = `in`.read() while (x < 33); if (x == 45) { q = true; x = `in`.read() }
        do { n = n * 10 - x + 48; x = `in`.read() } while (x > 32); return if (q) n else -n
    }
    val int get() = ll().toInt(); val long get() = ll()
    fun ints(n: Int = int): IntArray { return IntArray(n) { int } }
    fun ints1(n: Int = int): IntArray { return IntArray(n) { int - 1 } }
    val cout = PrintWriter(System.out); val nl = "\n"
    operator fun PrintWriter.rangeTo(a: Int): PrintWriter { print(a); print(" "); return this }
    operator fun PrintWriter.rangeTo(a: Long): PrintWriter { print(a); print(" "); return this }
    operator fun PrintWriter.rangeTo(a: IntArray): PrintWriter { a.forEach { print(it); print(" ") }; return this }
    operator fun PrintWriter.rangeTo(a: String): PrintWriter { write(a); return this }
} // @formatter:on

/* ----------- */

import java.awt.Point
import java.io.*
import java.lang.StringBuilder
import java.lang.System.`in`
import java.util.*

fun solve(stringBuilder: StringBuilder, reader: Reader) {
    stringBuilder.append("no")
}

//---------------------------------------------------------------------------------------------------------------------

fun main() {
    val reader = Reader()

    val stringBuilder = StringBuilder()

    solve(stringBuilder, reader)

    val bw = BufferedWriter(OutputStreamWriter(System.out))
    bw.write(stringBuilder.toString())

    bw.flush()
    bw.close()
    reader.close()
}

class Reader : Closeable {
    private var bufferedReader: BufferedReader = BufferedReader(InputStreamReader(`in`))
    private var tokenizer: StringTokenizer = StringTokenizer(bufferedReader.readLine())

    fun getNextToken(): String {
        if (!tokenizer.hasMoreTokens()) {
            tokenizer = StringTokenizer(bufferedReader.readLine())
        }
        return tokenizer.nextToken()
    }

    fun getNextInt() = getNextToken().toInt()

    fun getNextLong() = getNextToken().toLong()

    fun getNextULong() = getNextToken().toULong()

    fun getNextDouble() = getNextToken().toDouble()

    fun getNextIntArray(n : Int) : IntArray {
        val array = IntArray(n)
        for (i in array.indices) {
            array[i] = getNextInt()
        }
        return array
    }

    fun getNextLongArray(n : Int) : LongArray {
        val array = LongArray(n)
        for (i in array.indices) {
            array[i] = getNextLong()
        }
        return array
    }

    fun getNextDoubleArray(n : Int) : DoubleArray {
        val array = DoubleArray(n)
        for (i in array.indices) {
            array[i] = getNextDouble()
        }
        return array
    }

    fun getNextStringIntArray() : IntArray = bufferedReader.readLine().split(" ").filter { it.isNotEmpty() }.map { it.toInt() }.toIntArray()

    fun getNextStringLongArray() : LongArray = bufferedReader.readLine().split(" ").filter { it.isNotEmpty() }.map { it.toLong() }.toLongArray()

    fun getNextStringDoubleArray() : DoubleArray = bufferedReader.readLine().split(" ").filter { it.isNotEmpty() }.map { it.toDouble() }.toDoubleArray()

    override fun close() {
        bufferedReader.close()
    }
}

fun normalMod(d : Long, mod : Long) : Long = ((d % mod) + mod) % mod

fun modAdd(x : Long, y : Long, mod: Long) : Long = normalMod(normalMod(x, mod) + normalMod(y, mod), mod)

fun modSub(x : Long, y : Long, mod: Long) : Long = normalMod(normalMod(x, mod) - normalMod(y, mod), mod)

fun modMul(x : Long, y : Long, mod: Long) : Long = normalMod(normalMod(x, mod) * normalMod(y, mod), mod)

// если модуль точно простой
fun modDivWithSimpleMod(x : Long, y: Long, mod: Long) : Long {
    return modMul(x, y.toBigInteger().modPow((mod - 2L).toBigInteger(), mod.toBigInteger()).toLong(), mod)
}

// если модуль точно простой
fun modDivWithAnyMod(x : Long, y: Long, mod: Long) : Long {
    var point = GcdCalculate(1, 0, mod)
    gcdExtCalculate(y, mod, point)
    if (x % point.d != 0L) {
        return -1L
    }
    return modMul(x / point.d, point.x, mod)
}

//наибольший общий делитель при помощи алгоритма Эвклида
fun Long.getGCD(a : Long) : Long {
    var x = this
    var y = a

    if (Math.abs(this) > Math.abs(a)) {
        x = a
        y = this
    }

    while (y != 0L && x != 0L) {
        val rest = y % x
        if (rest > Math.abs(x)) {
            y = rest
        } else {
            y = x
            x = rest
        }
    }
    return x + y
}

// решение уравленения вида ax + by = d при помощи расширенного алгоритма Эвклида
fun Long.getGCDExt(a : Long) : Point {
    val datum = GcdCalculate(1L, 0L, 1L)
    gcdExtCalculate(this, a, datum)
    return Point(datum.x.toInt(), datum.y.toInt())
}

// есть ли в диофантовом уравнении вида ax + by = d целочисленное решение
fun Long.GCDInDiofantExistSolution(a : Long, c : Long) : Boolean {
    val gcd = this.getGCD(a)
    return c % gcd == 0L
}

// получить целочисленное решение в диофантовом уравнении вида ax + by = d
fun Long.getGCDExtLikeDiofant(a : Long, c : Long) : Point {
    val d = this.getGCD(a)
    val datum = GcdCalculate(1, 0, 1)
    gcdExtCalculate(this, a, datum)
    datum.x = datum.x * c / d
    datum.y = datum.y * c / d
    return Point(datum.x.toInt(), datum.y.toInt())
}

//вспомогательный метод
fun gcdExtCalculate(a : Long, b: Long, datum : GcdCalculate) {
    if (b == 0L) {
        datum.d = a
        datum.x = 1
        datum.y = 0
        return
    }
    gcdExtCalculate(b, a % b, datum)
    val s = datum.y
    datum.y = datum.x - (a / b) * datum.y
    datum.x = s
}
//вспомогательный класс
data class GcdCalculate(var x : Long, var y : Long, var d : Long)

//  PalindromeHashing(s + s.reversed())
// структура хешинга для нахождения палиндрома
internal class PalindromeHashing(s: String) {
    val X = 566239L
    val M = 1000000007L
    val h: LongArray
    val t: LongArray

    init {
        val length = s.length
        h = LongArray(length + 1)
        t = LongArray(length + 1)
        t[0] = 1
        for (i in 0 until length) {
            t[i + 1] = (t[i] * X % M)
            h[i + 1] = ((h[i] * X + s[i].toLong()) % M)
        }
    }

    fun hash(from: Int, to: Int): Long {
        var res = ((h[to] - h[from] * t[to - from]) % M)
        if (res < 0L) {
            res += M
        }
        return res
    }
}

fun Boolean.toYesNo() : String = if (this) "YES" else "NO"

import java.util.StringTokenizer
import java.io.PrintWriter

fun main() {
  for(t in 1..1) {
    wr("NO")
  }
}

@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out
@JvmField val _reader = INPUT.bufferedReader()

fun readLine(): String? = _reader.readLine()
fun readLn(): String = _reader.readLine()!!

@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")

fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}

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

fun charToDecimalEquiv(num: Char) = num.toInt() - '0'.toInt()

fun <T> wr(a: T) = println(a)
fun <T> wr(a: Array<T>, separator: String = " ") = println(a.joinToString(separator))
fun wr(a: IntArray, separator: String = " ") = println(a.joinToString(separator))
fun wr(a: LongArray, separator: String = " ") = println(a.joinToString(separator))

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

fun main(args: Array<String>) {

println("No")
}

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

import java.io.PrintWriter
import java.util.Arrays
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() {
    println("NO")
}

const val MOD = 998244353
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod

fun Int.powMod(exponent: Int, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

inline fun Int.toModInt() = ModInt(this umod MOD)
inline fun Long.toModInt() = ModInt(this umod MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent umod TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent umod TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

fun ModInt.powArray(n: Int): ModIntArray {
    val res = ModIntArray(n+1)
    res[0] = ModInt(1)
    for(i in 1..n) res[i] = res[i-1] * this
    return res
}

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

/** 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 _ln = ""
@JvmField var _lnPtr = 0
fun read(): String {
    while (_lnPtr >= _ln.length) {
        _ln = readLine() ?: return ""
        _lnPtr = 0
    }
    var j = _ln.indexOf(' ', _lnPtr)
    if(j < 0) j = _ln.length
    val res = _ln.substring(_lnPtr, j)
    _lnPtr = j + 1
    return res
}
fun readRem(): String /* reads remainder of current line */ =
    _ln.substring(min(_lnPtr, _ln.length)).also { _lnPtr = _ln.length }
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(0x594E215C123 * 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 `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}

fun main(args:Array<String>) {
    println("No")
}

import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    println("No")
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

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()
}

fun main(args: Array<String>) {
 println("NO");
}

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

fun main(args : Array<String>) {

    println("No")

}

import java.util.*

fun main() {
//    val sc = Scanner(File("input-a.txt"))
//    SolutionSample().doSolve(sc)
    println("No")
}

class SolutionA {
    fun doSolve(sc: Scanner) {
        val line: String = sc.nextLine()
        println(line)
    }
}

fun main(args: Array<String>) {
    val input = readLine()!!
    print(input)
}

import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    println("Unrated")
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

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()
}


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")

}