keep reading Ints in from the 1M Ints,
constructing a Sorted map, key is the Int, value is its freq,
once the mem is full, say 1500 entries,
output to a temp file,
repeat this step,
.....
now u get at the most ceil(1M/1500) = 667 tmp files, all sorted internally
by key with key-value pairs,
now take the first entry from each tmp file,
MERGE: merge in mem, say <1, 5> and <1, 2> merge to <1, 7>,
remember the min key is from which tmp fileS, it may come from more than 1
tmp file,say tmp x and tmp y,
output the min key with its freq and remove the entry from mem,
read in next entries from tmp x and tmp y(if there r still entries)
if map is empty, done,
else goto MERGE