fun main(arr: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
    val ans = (-100..100).map {target->a.map { (it-target)*(it-target) }.sum() }.min()
    println(ans)

}

