#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
int n, id;
int c[N];
int b[N];
int a[N];
bool luk[N];
vector<pair<int, int>> ans;
map<int, set<int>> mp;
bool lucky(int x) {
  while (x) {
    int rem = x % 10;
    if (rem != 4 && rem != 7) return 0;
    x /= 10;
  }
  return 1;
}
bool sorted() {
  for (int i = 1; i < n; i++)
    if (b[i] > b[i + 1]) return 0;
  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];
    if (lucky(a[i])) {
      luk[i] = 1;
      id = i;
    }
    mp[a[i]].insert(i);
    c[i] = b[i] = a[i];
  }
  sort(a + 1, a + 1 + n);
  if (!id && !sorted()) return cout << -1, 0;
  for (int i = n; i >= 1; i--) {
    if (b[i] == a[i] && id != i) {
      mp[b[i]].erase(i);
      continue;
    }
    if (i != id) {
      mp[b[i]].erase(i);
      mp[b[id]].erase(id);
      mp[b[i]].insert(id);
      mp[b[id]].insert(i);
      swap(b[i], b[id]);
      ans.push_back({i, id});
      id = i;
    }
    int idx = *mp[a[i]].rbegin();
    if (idx != id) {
      mp[a[i]].erase(idx);
      mp[b[id]].erase(id);
      mp[b[id]].insert(idx);
      swap(b[id], b[idx]);
      ans.push_back({idx, id});
      id = idx;
    }
  }
  cout << ans.size() << "\n";
  for (auto x : ans) cout << x.first << " " << x.second << "\n";
}
