import java.util.Scanner; import java.util.TreeMap; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); int i = Integer.valueOf(s); TreeMap<Integer,Integer> map = new TreeMap<>...