public static void smallRangeInntTreeHungrySort(int[] a) {
    int prev = a[0];
    int ind = 0;
    SmallRangeInntTree it = new SmallRangeInntTree();
    for (int i = 1; i < a.length; i++) {
      int t = a[i];
      if (t == prev) continue;
      it.put(prev, i - ind);
      ind = i;
      prev = t;
    }
    it.put(prev, a.length - ind);

    pasteIntoArray(it, a);
  }
  public static void smallRangeInntTreeSort(int[] a) {
    SmallRangeInntTree it = new SmallRangeInntTree();
    for (int i : a) it.put(i);

    pasteIntoArray(it, a);
  }