#import <stdio.h>
#import <stdlib.h>
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
typedef long long Int;
int desc(const void *a, const void *b) {
    Int d = *(Int *)b - *(Int *)a;
    return (d > 0) ? 1 : (d < 0) ? -1 : 0;
}
int main() {
    Int n;
    scanf("%lld", &n);
    Int *a = (Int *)malloc(sizeof(Int) * 2*n);
    rep(i, 2 * n) scanf("%lld", a + i);
    qsort(a, 2 * n, sizeof(Int), desc);
    Int ans = 0;
    rep(i, n) ans += a[2 * i + 1];
    printf("%lld\n", ans);
}

; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_936/source.m'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_936/source.m"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
  %0 = load i64, ptr %b, align 8, !tbaa !5
  %1 = load i64, ptr %a, align 8, !tbaa !5
  %cmp = icmp sgt i64 %0, %1
  %cmp1.not = icmp ne i64 %0, %1
  %cond = sext i1 %cmp1.not to i32
  %cond2 = select i1 %cmp, i32 1, i32 %cond
  ret i32 %cond2
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
  %n = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #7
  %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
  %0 = load i64, ptr %n, align 8, !tbaa !5
  %mul = shl i64 %0, 4
  %call1 = call noalias ptr @malloc(i64 noundef %mul) #8
  %.tr = trunc i64 %0 to i32
  %conv = shl i32 %.tr, 1
  %cmp27 = icmp sgt i32 %conv, 0
  br i1 %cmp27, label %for.body.preheader, label %for.cond.cleanup

for.body.preheader:                               ; preds = %entry
  %wide.trip.count = zext i32 %conv to i64
  br label %for.body

for.cond.cleanup.loopexit:                        ; preds = %for.body
  %.pre = load i64, ptr %n, align 8, !tbaa !5
  br label %for.cond.cleanup

for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry
  %1 = phi i64 [ %.pre, %for.cond.cleanup.loopexit ], [ %0, %entry ]
  %mul5 = shl nsw i64 %1, 1
  call void @qsort(ptr noundef %call1, i64 noundef %mul5, i64 noundef 8, ptr noundef nonnull @desc) #7
  %2 = load i64, ptr %n, align 8, !tbaa !5
  %conv8 = trunc i64 %2 to i32
  %cmp1029 = icmp sgt i32 %conv8, 0
  br i1 %cmp1029, label %for.body13.preheader, label %for.cond.cleanup12

for.body13.preheader:                             ; preds = %for.cond.cleanup
  %wide.trip.count38 = and i64 %2, 4294967295
  %min.iters.check = icmp ult i64 %wide.trip.count38, 5
  br i1 %min.iters.check, label %for.body13.preheader43, label %vector.ph

vector.ph:                                        ; preds = %for.body13.preheader
  %n.mod.vf = and i64 %2, 3
  %3 = icmp eq i64 %n.mod.vf, 0
  %4 = select i1 %3, i64 4, i64 %n.mod.vf
  %n.vec = sub nsw i64 %wide.trip.count38, %4
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
  %vec.phi40 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
  %5 = shl nuw nsw i64 %index, 1
  %6 = shl i64 %index, 1
  %7 = or i64 %5, 1
  %8 = or i64 %6, 5
  %9 = getelementptr inbounds i64, ptr %call1, i64 %7
  %10 = getelementptr inbounds i64, ptr %call1, i64 %8
  %wide.vec = load <4 x i64>, ptr %9, align 8, !tbaa !5
  %wide.vec41 = load <4 x i64>, ptr %10, align 8, !tbaa !5
  %strided.vec = shufflevector <4 x i64> %wide.vec, <4 x i64> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec42 = shufflevector <4 x i64> %wide.vec41, <4 x i64> poison, <2 x i32> <i32 0, i32 2>
  %11 = add <2 x i64> %strided.vec, %vec.phi
  %12 = add <2 x i64> %strided.vec42, %vec.phi40
  %index.next = add nuw i64 %index, 4
  %13 = icmp eq i64 %index.next, %n.vec
  br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %12, %11
  %14 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  br label %for.body13.preheader43

for.body13.preheader43:                           ; preds = %for.body13.preheader, %middle.block
  %indvars.iv33.ph = phi i64 [ 0, %for.body13.preheader ], [ %n.vec, %middle.block ]
  %ans.030.ph = phi i64 [ 0, %for.body13.preheader ], [ %14, %middle.block ]
  br label %for.body13

for.body:                                         ; preds = %for.body.preheader, %for.body
  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %add.ptr = getelementptr inbounds i64, ptr %call1, i64 %indvars.iv
  %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body

for.cond.cleanup12:                               ; preds = %for.body13, %for.cond.cleanup
  %ans.0.lcssa = phi i64 [ 0, %for.cond.cleanup ], [ %add15, %for.body13 ]
  %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #7
  ret i32 0

for.body13:                                       ; preds = %for.body13.preheader43, %for.body13
  %indvars.iv33 = phi i64 [ %indvars.iv.next34, %for.body13 ], [ %indvars.iv33.ph, %for.body13.preheader43 ]
  %ans.030 = phi i64 [ %add15, %for.body13 ], [ %ans.030.ph, %for.body13.preheader43 ]
  %15 = shl nuw nsw i64 %indvars.iv33, 1
  %16 = or i64 %15, 1
  %arrayidx = getelementptr inbounds i64, ptr %call1, i64 %16
  %17 = load i64, ptr %arrayidx, align 8, !tbaa !5
  %add15 = add nsw i64 %17, %ans.030
  %indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
  %exitcond39.not = icmp eq i64 %indvars.iv.next34, %wide.trip.count38
  br i1 %exitcond39.not, label %for.cond.cleanup12, label %for.body13, !llvm.loop !12
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #6

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }

!llvm.linker.options = !{}
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
