#include <bits/stdc++.h>
using namespace std;
int _;
const int maxn = 111 * 1000;
int n;
pair<int, int> a[maxn];
int lucky;
int pos[maxn];
int backpos[maxn];
vector<pair<int, int> > ans;
bool Lucky(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
void makeSwap(int x, int y) {
  if (x == y) return;
  ans.push_back(pair<int, int>(x, y));
  swap(backpos[pos[x]], backpos[pos[y]]);
  swap(pos[x], pos[y]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  lucky = -1;
  for (__typeof(n) i = (0); i < (n); ++i) {
    cin >> a[i].first;
    a[i].second = i;
    if (Lucky(a[i].first)) lucky = i;
  }
  sort(a, a + n);
  for (__typeof(n) i = (0); i < (n); ++i) {
    pos[a[i].second] = i;
    backpos[i] = a[i].second;
  }
  for (__typeof(n) i = (0); i < (n); ++i) {
    int cur = backpos[i];
    if (!Lucky(a[i].first) && cur != i) {
      if (lucky == -1) {
        cout << -1 << endl;
        return 0;
      }
      makeSwap(lucky, i);
      makeSwap(i, cur);
      lucky = cur;
    }
  }
  for (__typeof(n) i = (0); i < (n); ++i) {
    int cur = backpos[i];
    if (cur != i) {
      makeSwap(cur, i);
    }
  }
  cout << ((int)(ans).size()) << endl;
  for (__typeof(((int)(ans).size())) i = (0); i < (((int)(ans).size())); ++i)
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
  return 0;
}
