// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func getStreth(aryX:[Int],ave:Int) -> Int {
    return aryX.map { Int(pow(Double($0 - ave), 2.0)) }
    .reduce(0) { $0 + $1 }
}

func main() {
    let n = Int(readLine()!)!
    let aryX = readInts()
    //_____________________________ここまで入力
    
    var ans = 0
    var count = aryX.reduce(0) { $0 + $1 } / n - 1
    print(count)
    
    while ans > getStreth(aryX: aryX, ave: count) || ans <= 0{
        ans = getStreth(aryX: aryX, ave: count)
        count += 1
    }
        
    print(ans)
}

main()



