package main import ( "bufio" "fmt" "os" "sort" "strconv" "strings" ) func main() { sc := bufio.NewScanner(os.Stdin) sc.Buffer(make([]byte, 0, 100000*7+2), 100000*7+2) sc.Scan() N, _ := strconv.Atoi(sc.Text()) sc.Scan() ss := strings.Fields(sc.Text()) A := make([]int, 2*N) for i, s := range ss { A[i], _ = strconv.Atoi(s) } sort.Slice(A, func(i, j int) bool { return A[i] < A[j] }) sum := 0 for i := 0; i < 2*N; i += 2 { sum += A[i] * A[i+1] } fmt.Println(sum) }