#include <bits/stdc++.h>
using namespace std;
int n, x, r[100000], pos[100000], flag = 1, flag2;
pair<int, int> a[100000];
vector<int> ans, ans2;
int l(int n) {
  if (!n) return 1;
  if (n % 10 == 4 || n % 10 == 7) return l(n / 10);
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[i] = pair<int, int>(x, i);
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    r[a[i].second] = i;
    pos[i] = a[i].second;
    if (a[i].second != i) flag = 0;
    if (!flag2 && l(a[i].first)) x = i, flag2 = 1;
  }
  if (flag) {
    cout << 0 << endl;
    return 0;
  }
  if (!flag2) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++)
    if (i != x) {
      if (pos[i] == i) continue;
      if (pos[x] != i) {
        ans.push_back(pos[x]), ans2.push_back(i);
        int temp = pos[x];
        swap(pos[x], pos[r[i]]);
        swap(r[temp], r[i]);
      }
      ans.push_back(pos[x]), ans2.push_back(pos[i]);
      swap(pos[x], pos[i]);
      swap(r[pos[x]], r[pos[i]]);
    }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i] + 1 << " " << ans2[i] + 1 << endl;
}
