#include using namespace std; #define int long long #define pb push_back #define fi first #define se second #define rep(i,s,n) for(int i = s;i=(s);i--) #define all(v) (v).begin(),(v).end() #define chmin(a,b) a=min((a),(b)) #define chmax(a,b) a=max((a),(b)) #define endl '\n' #define IOS() ios_base::sync_with_stdio(0);cin.tie(0) typedef long long ll; typedef pairpint; typedef vectorvint; const ll MOD=1000000007,INF=1e18; int N; int dp[1ll<<20]; signed main() { IOS(); cin>>N; vint a(N); rep(i,0,N)cin>>a[i]; rep(i,0,(1ll<