Problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Petya got an array consisting of n numbers, it is the gift for his birthday. Now he wants to sort it in the non-decreasing order. However, a usual sorting is boring to perform, that's why Petya invented the following limitation: one can swap any two numbers but only if at least one of them is lucky. Your task is to sort the array according to the specified limitation. Find any possible sequence of the swaps (the number of operations in the sequence should not exceed 2n).

Input

The first line contains an integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n positive integers, not exceeding 109 — the array that needs to be sorted in the non-decreasing order.

Output

On the first line print number k (0 ≤ k ≤ 2n) — the number of the swaps in the sorting. On the following k lines print one pair of distinct numbers (a pair per line) — the indexes of elements to swap. The numbers in the array are numbered starting from 1. If it is impossible to sort the given sequence, print the single number -1.

If there are several solutions, output any. Note that you don't have to minimize k. Any sorting with no more than 2n swaps is accepted.

Examples

Input

2
4 7


Output

0


Input

3
4 2 1


Output

1
1 3


Input

7
77 66 55 44 33 22 11


Output

7
1 7
7 2
2 6
6 7
3 4
5 3
4 5

Solution (in JAVA):

Solution:
import java.util.HashMap;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Collection;
import java.util.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author AlexFetisov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {

    private HashMap<Integer, HashSet<Integer>> dict;
    private int[] a;
    private int[] b;
    int[] original;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        a = Utils.readIntArray(in, n);
        original = a.clone();
        b = a.clone();
        dict = new HashMap<Integer, HashSet<Integer>>();
        for (int i = 0; i < n; ++i) {
            addToDict(i, a[i]);
        }
        Arrays.sort(b);
        int id = -1;
        for (int i = 0; i < n; ++i) {
            if (isLucky(a[i])) {
                id = i;
                break;
            }
        }
        if (ArrayUtils.equals(a, b)) {
            out.println(0);
            return;
        }
        if (id == -1) {
            out.println(-1);
            return;
        }
        int number = a[id];
        int countNumber = 0;
        for (int i = 0; i < n; ++i) {
            if (a[i] == number) {
                ++countNumber;
            }
        }
        result = new ArrayList<Pair<Integer, Integer>>();
        for (int i = 0; i < n; ++i) {
            if (b[i] == number) {
                if (countNumber > 1) {
                    --countNumber;
                    if (a[i] == b[i]) {
                        removeFromDict(i, a[i]);
                        id = getFromDict(number);
                    } else {
                        putDirectly(i, b[i]);
                        removeFromDict(i, a[i]);
                        id = getFromDict(number);
                    }
                }
            } else {
                if (b[i] == a[i]) {
                    removeFromDict(i, a[i]);
                    continue;
                }
                if (id == i) {
                    id = putDirectly(i, b[i]);
                } else {
                    switchOur(id, i);
                    id = putDirectly(i, b[i]);
                }
            }
        }
        out.println(result.size());
        for (Pair<Integer, Integer> p : result) {
            out.println(p.first + " " + p.second);

            int id1 = p.first-1;
            int id2 = p.second-1;
            if (!isLucky(original[id1]) && !isLucky(original[id2])) {
                throw new AssertionError("Swap should have lucky number!");
            }
            int t = original[id1];
            original[id1] = original[id2];
            original[id2] = t;
        }
        if (!ArrayUtils.equals(original, b)) {
            throw new AssertionError("Not sorted!");
        }
    }

    private int putDirectly(int where, int what) {
        int id2 = getFromDict(what);
        switchOur(where, id2);
        removeFromDict(where, b[where]);
        return id2;
    }

    private int getFromDict(int what) {
        if (dict.containsKey(what)) {
            HashSet<Integer> set = dict.get(what);
            if (!set.isEmpty()) {
                return set.iterator().next();
            }
        }
        throw new AssertionError("!");
    }

    private void switchOur(int id, int id2) {
        removeFromDict(id, a[id]);
        removeFromDict(id2, a[id2]);
        int t = a[id];
        a[id] = a[id2];
        a[id2] = t;
        addToDict(id, a[id]);
        addToDict(id2, a[id2]);
        addToResult(id, id2);
    }

    private void removeFromDict(int pos, int number) {
        if (dict.containsKey(number)) {
            HashSet<Integer> set = dict.get(number);
            set.remove(pos);
            dict.put(number, set);
        }
    }

    private void addToDict(int pos, int number) {
        if (dict.containsKey(number)) {
            HashSet<Integer> set = dict.get(number);
            set.add(pos);
            dict.put(number, set);
        } else {
            HashSet<Integer> set = new HashSet<Integer>();
            set.add(pos);
            dict.put(number, set);
        }
    }

    private boolean isLucky(int x) {
        while (x != 0) {
            int m = x % 10;
            if (m != 4 && m != 7) return false;
            x /= 10;
        }
        return true;
    }

    List<Pair<Integer, Integer>> result;

    void addToResult(int a, int b) {
        ++a;
        ++b;
        if (a != b) {
            result.add(Pair.makePair(a, b));
        }
    }

}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String nextLine() {
        try {
            return reader.readLine().trim();
        } catch (IOException e) {
            return null;
        }
    }

    public String nextString() {
        while (stt == null || !stt.hasMoreTokens()) {
            stt = new StringTokenizer(nextLine());
        }
        return stt.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

}

class Utils {
    public static int[] readIntArray(InputReader in, int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
        }
        return a;
    }

}

class ArrayUtils {

    public static boolean equals(int[] a, int[] b) {
        if (a.length != b.length) return false;
        for (int i = 0; i < a.length; ++i) {
            if (a[i] != b[i]) return false;
        }
        return true;
    }

}

class Pair<U, V> implements Comparable<Pair<U, V>> {
    public final U first;
    public final V second;

    public static<U, V> Pair<U, V> makePair(U first, V second) {
        return new Pair<U, V>(first, second);
    }

    public Pair(U first, V second) {
        this.first = first;
        this.second = second;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Pair pair = (Pair) o;

        return !(first != null ? !first.equals(pair.first) : pair.first != null) && !(second != null ? !second.equals(pair.second) : pair.second != null);

    }

    public int hashCode() {
        int result = first != null ? first.hashCode() : 0;
        result = 31 * result + (second != null ? second.hashCode() : 0);
        return result;
    }

    public String toString() {
        return "(" + first + "," + second + ")";
    }

    public int compareTo(Pair<U, V> o) {
        int value = ((Comparable<U>)first).compareTo(o.first);
        if (value != 0)
            return value;
        return ((Comparable<V>)second).compareTo(o.second);
    }
}