#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using ll = long long;
using namespace std;
#define pb push_back
#define all(x) x.begin(), x.end()
#define speedup ios::sync_with_stdio(0), cin.tie(0)
#define pii pair<ll, ll>
#define tii tuple<ll, ll, ll>
template <typename T> using os = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int find_number(int mx) {
    int l = 1, r = mx + 1;
    while (r - l > 1) {
        int m = l + r >> 1;
        if (smaller(m)) r = m;
        else l = m;
    }
    return l;
}