You have an array a[1], a[2], ..., a[n], containing distinct integers from 1 to n. Your task is to sort this array in increasing order with the following operation (you may need to apply it multiple times):

  * choose two indexes, i and j (1 ≤ i < j ≤ n; (j - i + 1) is a prime number); 
  * swap the elements on positions i and j; in other words, you are allowed to apply the following sequence of assignments: tmp = a[i], a[i] = a[j], a[j] = tmp (tmp is a temporary variable). 



You do not need to minimize the number of used operations. However, you need to make sure that there are at most 5n operations.

Input

The first line contains integer n (1 ≤ n ≤ 105). The next line contains n distinct integers a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ n).

Output

In the first line, print integer k (0 ≤ k ≤ 5n) — the number of used operations. Next, print the operations. Each operation must be printed as "i j" (1 ≤ i < j ≤ n; (j - i + 1) is a prime).

If there are multiple answers, you can print any of them.

Examples

Input

3
3 2 1


Output

1
1 3


Input

2
1 2


Output

0


Input

4
4 2 3 1


Output

3
2 4
1 2
2 4
//package olymp_prog;

import javafx.util.Pair;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class C432 {
    static int n;
    static Number main[];
    static ArrayList<Integer> anotherOrderPrime;
    static ArrayList<Item> right;
    static StringBuffer ans;
    private static boolean[] prime;
    private static int len = 0;

    public static class Number {
        int n;
        Number (int n) {
            this.n = n;
        }
    }
    public static class Item {
        int val;
        Number number;

        Item(Number number, int val) {
            this.number = number;
            this.val = val;
        }
    }
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(
                new InputStreamReader(System.in)
        );
        n = Integer.parseInt(in.readLine());

        anotherOrderPrime = new ArrayList<>(n);
        ans = new StringBuffer(5 * n * 100);
        fillPrime(n + 10);
        main = new Number[n];
        for (int i = 0; i < n; i++) {
            main[i] = new Number(i);
        }
        right = new ArrayList<>(n);
        String raw[] = in.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            right.add(new Item(main[i], Integer.parseInt(raw[i])));
        }
        Collections.sort(right, (o1, o2) -> o1.val - o2.val);
        for (int i = 0; i < n; i++) {
            if (right.get(i).number.n <= i) continue;
            int j = right.get(i).number.n;
            if (prime[j - i + 1]) {
                swap(i, j);
            }else if ((j - i + 2) % 2 == 0) {
                int m = find(i, j);
                swap(i, m);
                swap(m, j);
                swap(i, m);
            } else {
                int m = find(i, j - 1);
                swap(i, m);
                swap(m, j - 1);
                swap(j - 1, j);
                swap(m, j - 1);
                swap(i, m);
            }
        }
        System.out.println(len);
        System.out.println(ans);
//        Pair<Integer, Integer> p;
//        for (int i = 0; i < len; i++) {
//            p = ans.get(i);
//            System.out.println(p.getKey() + " " + p.getValue());
//        }
    }

    private static int find(int l, int r) {
//        System.out.println("finding for " + (r - l + 1));
        int i = - 1;
        while (!prime[r + 2 - anotherOrderPrime.get(++i) - l]);
        return r + 1 - anotherOrderPrime.get(i);
    }

    private static void swap(int i, int j) {
        main[j].n = i;
        main[i].n = j;
        Number tmp = main[j];
        main[j] = main[i];
        main[i] = tmp;
        i++;
        j++;
        len++;
        ans.append(i).append(" ").append(j).append('\n');
    }


    private static void fillPrime(int n) {
        prime = new boolean[n];
        Arrays.fill(prime, true);
        for (int i = 2; i < n; i++) {
            if (prime[i]) {
                anotherOrderPrime.add(i);
                long start = (long)i * (long)i;
                if (start < n) for (int j = (int) start; j < n; j += i)
                    prime[j] = false;
            }

        }
    }
}
