#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>

using namespace std;

typedef __gnu_pbds::tree<
    int,
    __gnu_pbds::null_type,
    less<>,
    __gnu_pbds::rb_tree_tag,
    __gnu_pbds::tree_order_statistics_node_update>
    ordered_set;

int main() {
    ordered_set X;
    for(int i = 1; i<1024; i += i) {
        X.insert(i);
    }

    cout << "Order of key " << endl;
    for(int i = 1; i<1024; i += i) {
        cout << X.order_of_key(i) << " ";
    }

    cout << endl << "Get by order " << endl;

    for(int i = 0; i < 10; ++i) {
        cout << *X.find_by_order(i) << " ";
    }

    cout << endl;

    return 0;
}