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

using namespace std;
using namespace __gnu_pbds;

typedef
tree<
  int,
  null_type,
  less<int>,
  rb_tree_tag,
  tree_order_statistics_node_update>
set_t;

int main()
{
  set_t s;
  s.insert(12);
  s.insert(50);
  s.insert(30);
  s.insert(20);
  cout << "1st element: " << *s.find_by_order(1) << '\n';
  cout << "Position of 30: " << s.order_of_key(30) << '\n';
  return 0;
}
