#include <bits/stdc++.h>
using namespace std;
const int maxN = 1000 * 100 + 100;
int n;
pair<int, int> a[maxN];
int dont_set = -1;
int pos[maxN];
bool lucky(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return 0;
    x /= 10;
  }
  return 1;
}
bool ok() {
  for (int i = 0; i < (n); i++)
    if (a[i].second != i) return 0;
  return 1;
}
int ind;
int p[maxN];
int rev_p[maxN];
vector<pair<int, int> > ans;
void SWAP(int i) {
  if (ind != i) ans.push_back(pair<int, int>(ind + 1, i + 1));
  swap(p[i], p[ind]);
  swap(rev_p[p[i]], rev_p[p[ind]]);
  ind = i;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < (n); i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n);
  if (ok()) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < (n); i++)
    if (lucky(a[i].first)) {
      dont_set = i;
      ind = a[i].second;
    }
  if (dont_set == -1) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < (n); i++) {
    p[a[i].second] = i;
    rev_p[i] = a[i].second;
  }
  for (int i = 0; i < (n); i++) {
    if (i == dont_set) continue;
    SWAP(i);
    SWAP(rev_p[i]);
  }
  cout << (int)ans.size() << endl;
  for (int i = 0; i < ((int)ans.size()); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
