#include <bits/stdc++.h>
using namespace std;
const int N = (int)5e5 + 7, MOD = (int)1e9 + 7;
int n;
int b[N], ps[N], c[N], d[N];
pair<int, int> a[N];
vector<pair<int, int>> ans;
bool luck(int x) {
  int X = x;
  while (X) {
    if (X % 10 != 4 && X % 10 != 7) return 0;
    X /= 10;
  }
  return 1;
}
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first;
    c[i] = a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  bool ok = 1;
  for (int i = 2; i <= n; i++) {
    if (a[i].second < a[i - 1].second) {
      ok = 0;
    }
  }
  if (ok) {
    cout << 0 << "\n";
    exit(0);
  }
  for (int i = 1; i <= n; i++) {
    ps[i] = i;
    d[i] = i;
  }
  int pos = 0;
  for (int i = 1; i <= n; i++) {
    if (luck(a[i].first)) {
      pos = a[i].second;
      break;
    }
  }
  if (pos == 0) {
    cout << -1 << "\n";
    exit(0);
  }
  for (int i = 1; i <= n; i++) {
    if (d[i] == a[i].second || a[i].second == pos) continue;
    int x = 0, y = 0;
    if (ps[pos] != i) {
      ans.push_back({ps[d[i]], ps[pos]});
      x = ps[pos], y = i;
      swap(ps[d[i]], ps[pos]);
      swap(d[y], d[x]);
    }
    ans.push_back({ps[pos], ps[a[i].second]});
    x = ps[pos];
    y = ps[a[i].second];
    swap(ps[pos], ps[a[i].second]);
    swap(d[x], d[y]);
  }
  cout << (int)ans.size() << "\n";
  for (int i = 0; i < (int)ans.size(); i++) {
    cout << ans[i].first << ' ' << ans[i].second << "\n";
  }
  exit(0);
}
