#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ss second
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define ff first
#define en end
#define be begin
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ve vector
using namespace __gnu_pbds;
using namespace std;
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
bool smaller(int x);
int find_sum(int MAX){
    int l=1,r=MAX;
    while (l<r){
        int md=(l+r+1)/2;
        if (smaller(md)==1){
            r=md-1;
        }
        else l=md;
    }
    return l;
}
