N = int(input())

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

first = None
sol = []

for x in range(1, len(G)):
    if G[x] < G[x - 1]:
        if G[x] != G[x - 1] - 1:
            print("Nema spasa")
            exit()

        if first is None:
            first = x
    elif first:
        sol.append((first, x))
        first = None
        
if first:
    sol.append((first, N))
        

print("Svet je spasen")

print(len(sol))

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