java.util.*;Main { = ; mergSort(List a, l, r) { mid; (l < r) { mid = (l + r) / ; (a,l, mid); (a, mid + , r); List b1,b2; b1 = ArrayList (a.subList(l,mid+)); b2 = ArrayList (a.subList(mid+,r+)); List a1 = a.subList(l,r+); i1=,i2=,n1=b1.size(),n2=b2.size(),i=; (;i1 <= b2.get(i2)){ a1.set(i,b1.get(i1)); i1++; i++; } { a1.set(i,b2.get(i2)); i++; +=n1-i1; i2++; } } ( i1< n1){ a1.set(i,b1.get(i1)); i++; i1++; } ( i2< n2){ a1.set(i,b2.get(i2)); i++; i2++; } } } main(String[] args) { List a; Scanner scanner = Scanner(System.); a= ArrayList(); n1 = scanner.nextInt(); (i = ; i < n1; i++) { a.add(scanner.nextLong()); } (a, , n1 - ); System..println();}}