package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strings"
)

type Student struct {
	ID    int
	Value int
}

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var n int
	fmt.Fscan(r, &n)

	comparator := func(a, b interface{}) int {
		aAsserted := a.(*Student)
		bAsserted := b.(*Student)
		switch {
		case aAsserted.Value > bAsserted.Value:
			return 1
		case aAsserted.Value < bAsserted.Value:
			return -1
		default:
			return 0
		}
	}
	heap := NewBinaryHeapWith(comparator)

	for i := 0; i < n; i++ {
		var a int
		fmt.Fscan(r, &a)
		newStudent := &Student{
			ID:    i + 1,
			Value: a,
		}
		heap.Push(newStudent)
	}

	for heap.Size() != 0 {
		s, _ := heap.Pop()
		student := s.(*Student)
		fmt.Fprintf(w, "%d ", student.ID)
	}
	fmt.Fprint(w, "\n")
}

/* --- binaryheap --- */

type BinaryHeap struct {
	list       *ArrayList
	Comparator func(a, b interface{}) int
}

func NewBinaryHeapWith(comparator func(a, b interface{}) int) *BinaryHeap {
	return &BinaryHeap{list: NewArrayList(), Comparator: comparator}
}

func NewBinaryHeapWithIntComparator() *BinaryHeap {
	comparator := func(a, b interface{}) int {
		aAsserted := a.(int)
		bAsserted := b.(int)
		switch {
		case aAsserted > bAsserted:
			return 1
		case aAsserted < bAsserted:
			return -1
		default:
			return 0
		}
	}
	return &BinaryHeap{list: NewArrayList(), Comparator: comparator}
}

func NewBinaryHeapWithStringComparator() *BinaryHeap {
	comparator := func(a, b interface{}) int {
		s1 := a.(string)
		s2 := b.(string)
		min := len(s2)
		if len(s1) < len(s2) {
			min = len(s1)
		}
		diff := 0
		for i := 0; i < min && diff == 0; i++ {
			diff = int(s1[i]) - int(s2[i])
		}
		if diff == 0 {
			diff = len(s1) - len(s2)
		}
		if diff < 0 {
			return -1
		}
		if diff > 0 {
			return 1
		}
		return 0
	}
	return &BinaryHeap{list: NewArrayList(), Comparator: comparator}
}

func (heap *BinaryHeap) Push(values ...interface{}) {
	if len(values) == 1 {
		heap.list.Add(values[0])
		heap.bubbleUp()
	} else {
		for _, value := range values {
			heap.list.Add(value)
		}
		size := heap.list.Size()/2 + 1
		for i := size; i >= 0; i-- {
			heap.bubbleDownIndex(i)
		}
	}
}

func (heap *BinaryHeap) Pop() (value interface{}, ok bool) {
	value, ok = heap.list.Get(0)
	if !ok {
		return
	}
	lastIndex := heap.list.Size() - 1
	heap.list.Swap(0, lastIndex)
	heap.list.Remove(lastIndex)
	heap.bubbleDown()
	return
}

func (heap *BinaryHeap) Peek() (value interface{}, ok bool) {
	return heap.list.Get(0)
}

func (heap *BinaryHeap) Empty() bool {
	return heap.list.Empty()
}

func (heap *BinaryHeap) Size() int {
	return heap.list.Size()
}

func (heap *BinaryHeap) Clear() {
	heap.list.Clear()
}

func (heap *BinaryHeap) Values() []interface{} {
	return heap.list.Values()
}

func (heap *BinaryHeap) String() string {
	str := "BinaryHeap\n"
	values := []string{}
	for _, value := range heap.list.Values() {
		values = append(values, fmt.Sprintf("%v", value))
	}
	str += strings.Join(values, ", ")
	return str
}

func (heap *BinaryHeap) bubbleDown() {
	heap.bubbleDownIndex(0)
}

func (heap *BinaryHeap) bubbleDownIndex(index int) {
	size := heap.list.Size()
	for leftIndex := index<<1 + 1; leftIndex < size; leftIndex = index<<1 + 1 {
		rightIndex := index<<1 + 2
		smallerIndex := leftIndex
		leftValue, _ := heap.list.Get(leftIndex)
		rightValue, _ := heap.list.Get(rightIndex)
		if rightIndex < size && heap.Comparator(leftValue, rightValue) > 0 {
			smallerIndex = rightIndex
		}
		indexValue, _ := heap.list.Get(index)
		smallerValue, _ := heap.list.Get(smallerIndex)
		if heap.Comparator(indexValue, smallerValue) > 0 {
			heap.list.Swap(index, smallerIndex)
		} else {
			break
		}
		index = smallerIndex
	}
}

func (heap *BinaryHeap) bubbleUp() {
	index := heap.list.Size() - 1
	for parentIndex := (index - 1) >> 1; index > 0; parentIndex = (index - 1) >> 1 {
		indexValue, _ := heap.list.Get(index)
		parentValue, _ := heap.list.Get(parentIndex)
		if heap.Comparator(parentValue, indexValue) <= 0 {
			break
		}
		heap.list.Swap(index, parentIndex)
		index = parentIndex
	}
}

func (heap *BinaryHeap) withinRange(index int) bool {
	return index >= 0 && index < heap.list.Size()
}

/* --- arraylist --- */

type ArrayList struct {
	elements []interface{}
	size     int
}

const (
	arraylistGrowthFactor = float32(2.0)
	arraylistShrinkFactor = float32(0.25)
)

func NewArrayList(values ...interface{}) *ArrayList {
	list := &ArrayList{}
	if len(values) > 0 {
		list.Add(values...)
	}
	return list
}

func (list *ArrayList) Add(values ...interface{}) {
	list.growBy(len(values))
	for _, value := range values {
		list.elements[list.size] = value
		list.size++
	}
}

func (list *ArrayList) Get(index int) (interface{}, bool) {

	if !list.withinRange(index) {
		return nil, false
	}

	return list.elements[index], true
}

func (list *ArrayList) Remove(index int) {

	if !list.withinRange(index) {
		return
	}

	list.elements[index] = nil
	copy(list.elements[index:], list.elements[index+1:list.size])
	list.size--

	list.shrink()
}

func (list *ArrayList) Contains(values ...interface{}) bool {

	for _, searchValue := range values {
		found := false
		for _, element := range list.elements {
			if element == searchValue {
				found = true
				break
			}
		}
		if !found {
			return false
		}
	}
	return true
}

func (list *ArrayList) Values() []interface{} {
	newElements := make([]interface{}, list.size, list.size)
	copy(newElements, list.elements[:list.size])
	return newElements
}

func (list *ArrayList) IndexOf(value interface{}) int {
	if list.size == 0 {
		return -1
	}
	for index, element := range list.elements {
		if element == value {
			return index
		}
	}
	return -1
}

func (list *ArrayList) Empty() bool {
	return list.size == 0
}

func (list *ArrayList) Size() int {
	return list.size
}

func (list *ArrayList) Clear() {
	list.size = 0
	list.elements = []interface{}{}
}

func (list *ArrayList) Sort(comparator func(a, b interface{}) int) {
	if len(list.elements) < 2 {
		return
	}
	UtilSort(list.elements[:list.size], comparator)
}

func (list *ArrayList) Swap(i, j int) {
	if list.withinRange(i) && list.withinRange(j) {
		list.elements[i], list.elements[j] = list.elements[j], list.elements[i]
	}
}

func (list *ArrayList) Insert(index int, values ...interface{}) {

	if !list.withinRange(index) {
		if index == list.size {
			list.Add(values...)
		}
		return
	}

	l := len(values)
	list.growBy(l)
	list.size += l
	copy(list.elements[index+l:], list.elements[index:list.size-l])
	copy(list.elements[index:], values)
}

func (list *ArrayList) Set(index int, value interface{}) {

	if !list.withinRange(index) {
		if index == list.size {
			list.Add(value)
		}
		return
	}

	list.elements[index] = value
}

func (list *ArrayList) String() string {
	str := "ArrayList\n"
	values := []string{}
	for _, value := range list.elements[:list.size] {
		values = append(values, fmt.Sprintf("%v", value))
	}
	str += strings.Join(values, ", ")
	return str
}

func (list *ArrayList) withinRange(index int) bool {
	return index >= 0 && index < list.size
}

func (list *ArrayList) resize(cap int) {
	newElements := make([]interface{}, cap, cap)
	copy(newElements, list.elements)
	list.elements = newElements
}

func (list *ArrayList) growBy(n int) {
	currentCapacity := cap(list.elements)
	if list.size+n >= currentCapacity {
		newCapacity := int(arraylistGrowthFactor * float32(currentCapacity+n))
		list.resize(newCapacity)
	}
}

func (list *ArrayList) shrink() {
	if arraylistShrinkFactor == 0.0 {
		return
	}
	currentCapacity := cap(list.elements)
	if list.size <= int(float32(currentCapacity)*arraylistShrinkFactor) {
		list.resize(list.size)
	}
}

/*--- sort ---*/

func UtilSort(values []interface{}, comparator func(a, b interface{}) int) {
	sort.Sort(utilSortable{values: values, comparator: comparator})
}

type utilSortable struct {
	values     []interface{}
	comparator func(a, b interface{}) int
}

func (s utilSortable) Len() int {
	return len(s.values)
}
func (s utilSortable) Swap(i, j int) {
	s.values[i], s.values[j] = s.values[j], s.values[i]
}
func (s utilSortable) Less(i, j int) bool {
	return s.comparator(s.values[i], s.values[j]) < 0
}


Measured memory_bytes: 7928