// Arup Guha
// 4/28/2022
// Solution to COP 3503 Final Exam Question #12.

import java.util.*;

public class Q12 {

	public static void main(String[] args) {
	
		// Quick test.
		long[] stuff = {13L, -99L, 18L, 123456789L, 112233445566778899L, -100000000000000L};
		HashMap<Long,Integer> map = compress(stuff);
		
		// Double check the map.
		for (Long x: map.keySet())
			System.out.println(x+"\t"+map.get(x));
	}

	public static HashMap<Long,Integer> compress(long[] vals) {

		// We sort the values.
		Arrays.sort(vals);
		HashMap<Long,Integer> res = new HashMap<Long,Integer>();
		
		// Then we just map each value to its index.
		for (int i=0; i<vals.length; i++)
			res.put(vals[i], i);
		
		// Ta da!
		return res;
	}

}