description: Christmas is coming, Icy has just received a box of chocolates from her grandparents! The box contains n chocolates. The i-th chocolate has a non-negative integer type a_i.
  
  Icy believes that good things come in pairs. Unfortunately, all types of chocolates are distinct (all a_i are distinct). Icy wants to make at least one pair of chocolates the same type. 
  
  As a result, she asks her grandparents to perform some chocolate exchanges. Before performing any chocolate exchanges, Icy chooses two chocolates with indices x and y (1 ≤ x, y ≤ n, x ≠ y).
  
  In a chocolate exchange, Icy's grandparents choose a non-negative integer k, such that 2^k ≥ a_x, and change the type of the chocolate x from a_x to 2^k - a_x (that is, perform a_x := 2^k - a_x).
  
  The chocolate exchanges will be stopped only when a_x = a_y. Note that other pairs of equal chocolate types do not stop the procedure.
  
  Icy's grandparents are smart, so they would choose the sequence of chocolate exchanges that minimizes the number of exchanges needed. Since Icy likes causing trouble, she wants to maximize the minimum number of exchanges needed by choosing x and y appropriately. She wonders what is the optimal pair (x, y) such that the minimum number of exchanges needed is maximized across all possible choices of (x, y).
  
  Since Icy is not good at math, she hopes that you can help her solve the problem.
  
  Input
  
  The first line of the input contains a single integer n (2 ≤ n ≤ 2 ⋅ 10^5) — the number of chocolates.
  
  The second line of the input contains n integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 10^9).
  
  It is guaranteed that all a_i are distinct.
  
  Output
  
  Output three integers x, y, and m.
  
  x and y are indices of the optimal chocolates to perform exchanges on. Your output must satisfy 1 ≤ x, y ≤ n, x ≠ y.
  
  m is the number of exchanges needed to obtain a_x = a_y. We can show that m ≤ 10^9 for any pair of chocolates.
  
  If there are multiple solutions, output any.
  
  Examples
  
  Input
  
  
  5
  5 6 7 8 9
  
  
  Output
  
  
  2 5 5
  
  
  Input
  
  
  2
  4 8
  
  
  Output
  
  
  1 2 2
  
  Note
  
  In the first test case, the minimum number of exchanges needed to exchange a chocolate of type 6 to a chocolate of type 9 is 5. The sequence of exchanges is as follows: 6 → 2 → 0 → 1 → 7 → 9.
  
  In the second test case, the minimum number of exchanges needed to exchange a chocolate of type 4 to a chocolate of type 8 is 2. The sequence of exchanges is as follows: 4 → 0 → 8.
solution: #include <bits/stdc++.h>
  using namespace std;
  inline long long read() {
    long long x = 0, f = 1;
    char c = getchar();
    for (; !isdigit(c); c = getchar())
      if (c == '-') f = -1;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
    return x * f;
  }
  inline void out(int x) {
    if (x > 9) out(x / 10);
    putchar(x % 10 + 48);
  }
  inline void print(int x) {
    if (x < 0) putchar('-'), x = -x;
    out(x), puts("");
  }
  const int N = 2e5 + 10;
  int a[N], cnt, num[N * 20], ans, posx, posy, vis[N * 20];
  vector<int> v[N * 20];
  unordered_map<int, int> mp;
  int main() {
    int n = read();
    for (int i = 1; i <= n; i++) a[i] = read();
    for (int i = 1, x = a[i]; i <= n; i++, x = a[i]) {
      if (mp.find(x) == mp.end()) mp[x] = ++cnt;
      num[mp[x]] = i;
      while (x) {
        int k = log2(x) + 1, y = (1 << k) - x;
        if (mp.find(x) == mp.end()) mp[x] = ++cnt;
        if (mp.find(y) == mp.end()) mp[y] = ++cnt;
        if (x == y) {
          v[0].push_back(mp[x]), v[mp[x]].push_back(0);
          break;
        }
        v[mp[x]].push_back(mp[y]), v[mp[y]].push_back(mp[x]), x = y;
      }
    }
    queue<int> q;
    num[0] = num[mp[0]], mp[0] = 0, vis[0] = 1, q.push(0);
    int posx, posy;
    while (q.size()) {
      int x = q.front();
      q.pop();
      if (num[x]) posx = x;
      for (int y : v[x]) {
        if (vis[y]) continue;
        vis[y] = 1, q.push(y);
      }
    }
    q.push(posx), memset(vis, 0, sizeof vis), vis[posx] = 1;
    while (q.size()) {
      int x = q.front();
      q.pop();
      if (num[x]) posy = x, ans = vis[x] - 1;
      for (int y : v[x]) {
        if (vis[y]) continue;
        vis[y] = vis[x] + 1, q.push(y);
      }
    }
    cout << num[posx] << " " << num[posy] << " " << ans;
  }
  