class Node:

    solution = []
    ind = 1
    

    def __init__(self, value):
        self.less = None
        self.great = None
        
        self.value = value
        
        self.index = Node.ind
        Node.ind += 1

    def add(self, node):
        if node.value < self.value:
            if self.less:
                self.less.add(node)
            else:
                self.less = node
        else:
            if self.great:
                self.great.add(node)
            else:
                self.great = node

    def solve_main(self):
        if self.less:
            Node.solution.append(self.less.solve_sub(self.index))
            
        if self.great:
            return self.great.solve_main()
        else:
            return Node.solution

    def solve_sub(self, i):
        if self.great:
            print("Nema spasa")
            exit()
            
        if self.less:
            return self.less.solve_sub(i)
        else:
            return (i, self.index)

N = int(input())

G_temp = tuple(map(int, input().split()))

G = Node(G_temp[0])

for i in G_temp[1:]:
    G.add(Node(i))

sol = G.solve_main()

print("Svet je spasen")

print(len(sol))

for x in sol:
    print(x[0], x[1])