#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010], c[100010];
bool good(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return 0;
    x /= 10;
  }
  return 1;
}
vector<pair<int, int> > ans;
void Swap(int x, int y) {
  if (x == y) return;
  ans.push_back(pair<int, int>(x, y));
  swap(a[x], a[y]);
  b[a[x]] = x;
  b[a[y]] = y;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> c[i], b[i] = i;
  sort(b + 1, b + n + 1, [&](int i, int j) { return c[i] < c[j]; });
  for (int i = 1; i <= n; i++) a[b[i]] = i;
  int x = 0;
  for (int i = 1; i <= n; i++)
    if (good(c[i])) {
      x = a[i];
      break;
    }
  if (x == 0) {
    int flag = 0;
    for (int i = 1; i < n; i++)
      if (c[i] > c[i + 1]) flag = -1;
    cout << flag << endl;
    return 0;
  }
  for (int i = 1; i <= n; i++)
    if (i != x && b[i] != i) {
      int A = b[x], B = i, C = b[i];
      Swap(A, B), Swap(B, C);
    }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << ' ' << ans[i].second << endl;
}
