#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <list>
#include <iomanip>

using namespace std;

#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
#define rep(i,a,n) for(Int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(Int (i)=(a); (i)<=(n); (i)++)
const int MAX_N = 1000000;
const Int MAX_N_Int = 1000000000000;

template <typename T>
void printV(const std::vector<T>& v, const char * const separator = " ")
{
    if(!v.empty())
    {
        std::copy(v.begin(),
                  --v.end(),
                  std::ostream_iterator<T>(std::cout, separator));
        std::cout << v.back() << "\n";
    }
}

bool isPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
    //a*bは64bit integer overflow
}

int Max(int a, int b, int c) {
    int temp = max(a, b);
    return max(temp, c);
}

int Min(int a, int b, int c) {
    int temp = min(a, b);
    return min(temp, c);
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

Int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}

Int fact_mod(Int n, Int mod) {
    Int f = 1; repq(i,2,n) f = f * (i % MOD) % MOD;
    return f;
}

// 繰り返し二乗法 (modの世界での累乗)
Int mod_pow(Int x, Int n, Int mod) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

// 組み合わせ nCr を求める
Int combination_mod(Int n, Int r, Int mod) {
    if(r > n-r) r = n-r;
    if(r == 0) return 1;
    Int a = 1;
    rep(i, 0, r) a = a * ((n-i) % mod) % mod;
    Int b = mod_pow(fact_mod(r, mod), mod-2, mod);
    return (a % mod) * (b % mod) % mod;
}

Int cntZero(string s){
    int cnt=0;
    reverse(s.begin(),s.end());
    for (int i = 0; i < s.length(); ++i) {
        if(s[i]=='0')cnt++;
        else break;
    }
    return cnt;
}

int main() {
    //COMinit();
    IOS;
    prec;
    Int a,b,c,d,n,m,k,x,y=0,ans=0,ans1=0;
    string str,s="",t,u;
    Int h,w;
    cin>>h>>w>>n;
    Int cnt=0;
    rep(i,0,min(h,w)){
        ans+=max(h,w);
        cnt++;
        if(ans>=n){
            cout<<cnt<<endl;
            return 0;
        }
    }
    rep(i,0,max(h,w)){
        ans+=min(h,w);
        cnt++;
        if(ans>=n){
            cout<<cnt<<endl;
            return 0;
        }
    }

    cout<<endl;
    return 0;
}

#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for (int i = (int)n - 1; j <= i; --i)

constexpr ll MOD = 1000000007;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  int m = max(h, w);
  cout << (n + m - 1) / m << endl;

#ifdef LOCAL
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1001001001;

long long pow2[60];
void init_pow2(){
    pow2[0] = 1;
    for(int i=1; i<60; i++){
        pow2[i]  = 2*pow2[i-1];
        pow2[i] %= MOD;
    }
    return;
}

int main(){
    init_pow2();

    int n;cin>>n;
    vector<long long> a(n);
    vector<long long> count(60, 0);

    long long s = 0;
    for(int i=0; i<n; i++){
        cin>>a[i];
        s += a[i];
        s %= MOD;
        for(int j=0; j<60; j++){
            if((a[i]>>j)&1)count[j]++;
        }
    }

    s *= n-1;
    s %= MOD;

    for(int j=0; j<60; j++){
        long long t=1;
        t *= count[j]*(count[j]-1)/2;
        t %= MOD;
        t *= 2 * pow2[j];
        t %= MOD;
        s += MOD - t;
        s %= MOD;
    }

    cout << s << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
template <typename T>
struct Fenwick {
	int n;
	vector<T> bit;
	Fenwick(int _n) : n(_n) {
		bit.resize(n + 1);
	}
	void update(int p, T v) {
		for (; p <= n; p += p & -p) bit[p] += v;
	}
	T query(int p) {
		T ret{};
		for (; p; p -= p & -p) ret += bit[p];
		return ret;
	}
};
int main() {
	int n;
	scanf("%d", &n);
	vector<vector<int>> A(3, vector<int>(n));
	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < n; ++j) {
			scanf("%d", &A[i][j]);
			--A[i][j];
		}
	vector<int> flip(2);
	auto no = []() {
		printf("No\n");
		exit(0);
	};
	for (int c = 0; c < n; ++c) {
		if (A[0][c] / 3 != A[1][c] / 3 || A[1][c] / 3 != A[2][c] / 3 || A[1][c] % 3 != 1) {
			no();
		}
		if ((A[0][c] / 3) % 2 != (c % 2)) no();
		flip[c % 2] ^= A[0][c] % 3 == 2;
	}
	for (int p = 0; p < 2; ++p) {
		Fenwick<int> fenw(n);
		for (int c = p; c < n; c += 2) {
			int i = A[0][c] / 3;
			int greater = fenw.query(n) - fenw.query(i + 1);
			flip[1 - p] ^= greater & 1;
			fenw.update(i + 1, 1);
		}
	}
	printf(flip[0] == 0 && flip[1] == 0 ? "Yes\n" : "No\n");
}


// A.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <cmath>
#include <map>
#include <set>

using namespace std;

typedef long double LD;
typedef long long LL;

int main(int argc, char* argv[]) {
	LL n, nfc = 0, fc = 0, ans = 0;
	cin >> n;
	vector<vector<int>> sum(20, vector<int>(20));
	vector<int> two(n), five(n);
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		bool p = false;
		LL x = 0;
		for (char c : s) {
			if (c == '.') {
				p = true;
			} else {
				x = (x * 10) + c - '0';
				two[i] -= p;
				five[i] -= p;
			}
		}
		while (x % 2 == 0) {
			++two[i];
			x /= 2;
		}
		while (x % 5 == 0) {
			++five[i];
			x /= 5;
		}
		sum[min(two[i], 9) + 10][min(five[i], 9) + 10] += 1;
	}
	for (int i = 0; i < n; ++i) {
		for (int j = -10; j < 10; ++j) {
			for (int k = -10; k < 10; ++k) {
				if (j + two[i] >= 0 && k + five[i] >= 0) {
					ans += sum[j + 10][k + 10];
				}
			}
		}
		ans -= two[i] >= 0 && five[i] >= 0;
	}
	cout << ans / 2 << endl;
	return 0;
}

/*      Welcome to my Code      */

#include <bits/stdc++.h>
#define ll                      long long int
#define i(a,n)                  int a=n;
#define l(a,n)                  ll a=n;
#define d(a,n)                  double a=n;
#define s(a)                    string a;
#define c(a)                    ll a; cin>>a;a
#define cd(a)                   double a; cin>>a;
#define cs(a)                   string a; cin>>a;
#define ci(a)                   cin>>a;
#define co(a)                   cout<<a;
#define cos(a)                  cout<<a<<" ";
#define con(a)                  cout<<a<<endl;
#define yes                     cout<<"YES"<<endl
#define no                      cout<<"NO"<<endl
#define nl                      cout<<endl;
#define ca(arr,n)               for(ll i=0;i<n;i++) cin>>arr[i];
#define f0(i,a,n)               for(ll i=a;i>=n;i--)
#define f(i,n)                  for(ll i=0;i<n;i++)
#define f1(i,a,n)               for(ll i=a;i<n;i++)
#define lcm(a,b)                (a*b)/__gcd(a,b)
#define T                       ll t=1; cin>>t; while(t--)
#define fast                    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ret(x)                  return cout<<x,0;

using namespace std;

using namespace std;

int n;
long long ans;
long long num[25][25];
int main()
{
	cin>>n;
	while(n--)
	{
		double t;
		cin>>t;
		long long a=t*1e9+0.5;
		int n2=1,n5=1;
		while(a%2==0)
		{
			a/=2;
			n2++;
		}
		while(a%5==0)
		{
			a/=5;
			n5++;
		}
		n2=min(19,n2);
		n5=min(19,n5);
		f1(i,20-n2,20) f1(j,20-n5,20) ans+=num[i][j];
		num[n2][n5]++;
	}
	cout<<ans<<endl;
	return 0;
}

/*It's not who I am underneath, but what I do that defines me

MMMMMMMMMMMMMMMMMMMMM.                             MMMMMMMMMMMMMMMMMMMMM
 `MMMMMMMMMMMMMMMMMMMM           M\  /M           MMMMMMMMMMMMMMMMMMMM'
   `MMMMMMMMMMMMMMMMMMM          MMMMMM          MMMMMMMMMMMMMMMMMMM'
     MMMMMMMMMMMMMMMMMMM-_______MMMMMMMM_______-MMMMMMMMMMMMMMMMMMM
      MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
      MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
      MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
     .MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM.
    MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
                   `MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM'
                          `MMMMMMMMMMMMMMMMMM'
                              `MMMMMMMMMM'
                                 MMMMMM
                                  MMMM
                                   MM
*/


// B - Reverse and Compare

#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1000000007;
// using mint = modint1000000007;
// const ll MOD = 998244353;
// using mint = modint998244353;

int main() {
	string A;
	cin >> A;

	unordered_map<char, int> cnt;

	for (char c : A) {
		cnt[c]++;
	}

	ll N = A.size();
	ll ans = N * (N-1) / 2 + 1;

	for (auto itr : cnt) {
		ll n = itr.second;
		ans -= n * (n-1) / 2;
	}

	cout << ans << endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<(n);i++)
typedef long long ll;

int main(){
    ll x; cin >> x;
    ll y=x%11;
    ll ans=0;
    ans+=(x/11)*2;
    if(y>6){
        ans+=2;
    }else if(y>0){
        ans++;
    }
    cout << ans << endl;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
ll MOD = 1e9+7;
main(){
    ll N,M;
    cin >> N >> M;
    vector<ll> X(N),Y(M),accumX(N+1),accumY(M+1);
    rep(i,0,N){
        cin >> X[i];
        X[i] += 1e9;
        accumX[i+1] = (accumX[i] + X[i]) % MOD;
    }
    rep(i,0,M){
        cin >> Y[i];
        Y[i] += 1e9;
        accumY[i+1] = (accumY[i] + Y[i]) % MOD;
    }
    ll sumx = 0,sumy = 0;
    rep(i,0,N-1){
        sumx += (accumX[N] - accumX[i+1] - X[i] * (N-i-1) + MOD * MOD) % MOD;
        sumx %= MOD;
    }
    rep(i,0,M-1){
        sumy += (accumY[M] - accumY[i+1] - Y[i] * (M-i-1) + MOD * MOD) % MOD;
        sumy %= MOD;
    }
    cout << (sumx * sumy) % MOD << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  ll n,k;cin>>n>>k;
  vector<ll> a(n),b(k);
  rep(i,n)cin>>a[i];
  rep(i,k)cin>>b[i];
  ll c=0LL,d=0LL;
  ll j=-n+1;
  rep(i,n){
    c+=a[i]*j;
    j+=2;
  }
  j=-k+1;
  rep(i,k){
    d+=b[i]*j;
    j+=2;
  }
  cout<<(c%M)*(d%M)%M;
}


#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	vector<pair<ll,ll>> P(N);
	ll SA=0,SB=0;
	REP(i,N){
		P[i].first=in();
		P[i].second=in();
		SB += P[i].second;
	}

	sort(ALL(P),[](pair<ll,ll>& l,pair<ll,ll>& r){return l.first+l.second>r.first+r.second;});

	int H=ceil(N/2.0);
	REP(i,H){
		SA += P[2*i].first;
		SB -= P[2*i].second;
	}

	out(SA-SB);
	return 0;
}

#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;
typedef vector<int> ivec;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const int MOD=1000000007;
int INF=100100100100100;
int sa[100010];
signed main(){
  int n;cin>>n;
  int ans=0;
  rep(i,n){
    int a,b;cin>>a>>b;
    sa[i]=a+b;
    ans-=b;
  }
  sort(sa,sa+n,greater<int>());
  for(int i=0;i<n;i+=2){
    ans+=sa[i];
  }
  cout<<ans<<endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef vector<bool> vbool;
typedef vector<int> vint;

#define inf 1e+9
#define endl "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep_rev(i, n) for (int i = n-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()

#define pb push_back
#define eb emplace_back
#define Size(c) (int)(c).size()

#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))

template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {a = b;return 1;} return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {a = b;return 1;} return 0;
}
template <class T>
void line(vector<T> &x){for (auto&& xi : x) cin >> xi;}

inline void IN(void){ return;}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){ cin >> first; IN(rest...); return;}

#define INT(...) int __VA_ARGS__; IN (__VA_ARGS__)
#define LINT(...) lint __VA_ARGS__; IN (__VA_ARGS__)
#define STR(...) string __VA_ARGS__; IN(__VA_ARGS__)

template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x)); x.erase(unique(all(x)), x.end());
}
template <class T> void print_vec(T first, T end){
    for (auto i = first; i < end - 1; i++) cout << *i << " ";
    cout << *(end-1) << endl;
}

template<class... T>
void debug_print(T... args){
    vector<lint> tmp = initializer_list<lint>{args...};
    print_vec(all(tmp));
}
template<class T>
void print(T a){ cout << a << endl;}

vector<string> Yes = {"No", "Yes"};
vector<string> YES = {"NO", "YES"};

int ord(char x){ return (int)(x - 'a');}
char chr(lint x){ return (char)(x + (lint)('a'));}
lint mod = 1e9+7;
// lint mod =

lint sum(vlint a){lint ret = 0; for(auto&& v:a) ret += v; return ret;}
lint vmini(vlint a, lint &index){
    lint ret = LLONG_MAX;
    rep(i, Size(a)){ if (chmin(ret, a[i])) index = i;}
    return ret;
}
lint vmaxi(vlint a, lint &index){
    lint ret = -LLONG_MAX;
    rep(i, Size(a)){ if (chmax(ret, a[i])) index = i;}
    return ret;
}

lint vmin(vlint a){
    lint ret = LLONG_MAX; for (auto && v : a) chmin(ret, v); return ret;
}
lint vmax(vlint a){
    lint ret = -LLONG_MAX; for (auto && v : a) chmax(ret, v); return ret;
}

vlint base_3(int k){
    vlint ret; while (k > 0){ ret.pb(k % 3); k /= 3;} reverse(all(ret)); return ret;
}
map<lint, lint> trial_division(lint n){
    map<lint, lint> factor;
    lint tmp = (lint)(sqrt(n)) + 1;
    for (lint i = 2; i < tmp; ++i){
        while (n % i == 0){
            n /= i;
            factor[i] ++;
        }
    }
    if(n != 1) factor[n] ++;
    return factor;
}
bool judge(lint u){
    return 0 <= u && u <= 5000;
}
lint dist(lint x1, lint y1, lint x2, lint y2){
    return (x1-x2) * (x1-x2) + (y1-y2) * (y1 - y2);
}

int main(){
    LINT(n);
    vlint a(n), b(n), c(n);
    line(a); line(b); line(c);

    sort(all(a)); sort(all(c));
    lint u, d; lint ans = 0;
    rep(i, n){
        u = lb(a, b[i]);
        d = n - ub(c, b[i]);
        ans += u * d;
    }
    print(ans);

}

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define int long long
using P = pair<int, int>;

#define LOG(variable) cerr << #variable":\t" << (variable) << "\n"
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cerr << (i) << ":\t" << (container)[(i)] << "\n"
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
template<typename T = int>
T in() {T a; cin >> a; return a;}
/***** MAIN *****/
int lowerbound(vector<int> &v, int num) {
  int left = 0, right = v.size()-1;
  while(right-left > 0) {
    int mid = (left + right) / 2;
    if(v[mid] >= num) right = mid;
    else left = mid + 1;
  }
  if(v[left] >= num) return left;
  else return v.size();
}

int upperbound(vector<int> &v, int num) {
  int left = 0, right = v.size()-1;
  while(right-left > 0) {
    int mid = (left + right) / 2;
    if(v[mid] > num) right = mid;
    else left = mid + 1;
  }
  if(v[left] > num) return left;
  else return v.size();
}
signed main() {
  int n; cin >> n;
  vector<int> a(n), b(n), c(n);
  REP(i,n) cin >> a[i];
  REP(i,n) cin >> b[i];
  REP(i,n) cin >> c[i];
  SORT(a); SORT(b); SORT(c);
  int ans = 0;
  REP(i,n) {
    int upper_count = lowerbound(a, b[i]);
    int lower_count = n - upperbound(c, b[i]);
    ans += upper_count * lower_count;
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;

#define INF 2000000000

typedef pair<int, int> P;
struct edge{ int to, cost;};

int V, E;
vector<edge> G[100010];
int d[100010];

void dijkstra(int s){

  priority_queue<P, vector<P>, greater<P> > que;

  for(int i = 0;i < V;i++) d[i] = INF;
  d[s] = 0;
  que.push(P(0, s));

  while(!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;

    if(d[v] < p.first) continue;
    for(int i = 0;i < G[v].size();i++){
      edge e = G[v][i];
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

int main(){

  int r, s;
  edge e;

  cin >> V >> E >> r;
  for(int i = 0;i < E;i++){
    cin >> s >> e.to >> e.cost;
    G[s].push_back(e);
  }

  dijkstra(r);

  for(int i = 0;i < V;i++){
    if(d[i] == INF) cout << "INF" << endl;
    else cout << d[i] << endl;
  }

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
void chmax(int& a, int b) {
  if (a < b) a = b;
}

void chmin(int& a, int b) {
  if (a > b) a = b;
}

int main () {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;

  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    chmax(X, x);
  }
  for (int i = 0; i < M; i++) {
    int y;
    cin >> y;
    chmin(Y, y);
  }

  if (X < Y) {
    cout << "No War" << endl;
  } else {
    cout << "War" << endl;
  }
}


// 2014/11/05 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;

	int A[1000];
	for(int i=0; i<N; i++){
		cin >> A[i];
	}

	int B[1000];
	for(int i=0; i<M; i++){
		cin >> B[i];
	}

	int cnt[1000] = {0};
	for(int i=0; i<M; i++){
		for(int j=0; j<N; j++){
			if(B[i]>=A[j]){
				cnt[j]++;
				break;
			}
		}
	}

	int i_max = 0;
	for(int i=1; i<N; i++){
		if(cnt[i]>cnt[i_max]){
			i_max = i;
		}
	}

	cout << i_max+1 << endl;

	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
#include <deque>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=1000010;
char a[N],b[N];
deque<int>q;
inline int Main(){
	int n=ni;
	scanf("%s%s",a+1,b+1);
	q.push_back(n+1);
	int delta=0;
	int ans=0;
	for(int i=n,j=n+1;i>=1;i--){
		int last=j;
		for(;j>=1&&(i<j||b[i]!=a[j]);j--);
		if(j<1)return -1;
		if(last==j){
			for(;!q.empty()&&q.back()+delta>=i;q.pop_back());
			q.push_back(i-delta);
		}else{
			delta--;
			if(i!=j){
				apmax(ans,(int)q.size());
				q.push_front(j-delta);
			}
		}
	}
	return ans;
}
int main(){
	printf("%d\n",Main());
	return 0;
}


/*

強連結成分アルゴリズムアルゴリズム

input:有向グラフG
output:各店の属する強連結成分を表す関数comp:V(G)->N

*/

#include <vector>
#include <functional>
using namespace std;

vector<int> scc(const vector<vector<int>>& G){
    vector<int> comp(G.size(),-1);
    vector<int> R(G.size(),0);
    int N = 0;
    vector<int> psi(G.size(),-1);
    vector<int> psi_inv(G.size(),-1);

    function<void(int)> visit1 = [&](int v){
        R[v] = 1;
        for(int w : G[v]){
            if(R[w] == 0) visit1(w);
        }
        psi[v] = N;
        psi_inv[N] = v;
        N = N + 1;
    };

    for(int i = 0;i < G.size();i++){
        if(R[i] == 0) visit1(i);
    }

    R.assign(G.size(),0);
    int K = 0;

    vector<vector<int>> rev_G(G.size());

    for(int v = 0;v < G.size();v++){
        for(int to : G[v]) rev_G[to].push_back(v);
    }

    function<void(int)> visit2 = [&](int v){
        R[v] = 1;
        for(int w : rev_G[v]){
            if(R[w] == 0) visit2(w);
        }
        comp[v] = K;
    };

    for(int i = G.size() - 1;i >= 0;i--){
        if(R[psi_inv[i]] == 0){
            visit2(psi_inv[i]);
            K = K + 1;
        }
    }
    return comp;
}

#include <iostream>

int main(){
    int v;
    int e;
    cin >> v >> e;
    vector<vector<int>> G(v);
    for(int i = 0;i < e;i++){
        int x,y;
        cin >> x >> y;
        G[x].push_back(y);

    }

    auto res = scc(G);

    int q;
    cin >> q;

    for(int i = 0;i < q;i++){
        int x,y;
        cin >> x >> y;
        cout << (res[x] == res[y]) << endl;
    }
}

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    int n, m, q; cin >> n >> m >> q;
    vector<vector<int>> S(n, vector<int>(n));
    rep(i, m){
        int l, r; cin >> l >> r; l--, r--;
        S[l][r]++;
    }
    rep(i, n){
        rep(j, n-1){
            S[i][j+1] += S[i][j];
        }
    }
    rep(j, n){
        for(int i=n-1; i>0; i--){
            S[i-1][j] += S[i][j];
        }
    }

    vector<int> res(q);
    rep(i, q){
        int p, q; cin >> p >> q; p--, q--;
        res[i] = S[p][q];
    }
    for(auto r: res) cout << r << ln;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int A, B;
	cin >> A >> B;

	int u = A + B;
	int v = A + (A - 1);
	int w = B + (B - 1);

	printf("%d\n", max(u, max(v, w)));
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long ;
int main(){
    int a,b;
    cin >> a >> b;
    int ans=0;
    if(a>b) cout << 2*a-1 << endl;
    else if(a<b) cout << 2*b-1 << endl;
    else cout << 2*a << endl;
}


#include<bits/stdc++.h>

using namespace std;
using ll = long long int;

int main(void) {
    constexpr ll MOD = 1e9 + 7;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(16);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n, x;
    cin >> n >> x;
    vector<ll> dp(x+1);
    vector<ll> s(n);
    for(auto &e: s) cin >> e;
    sort(s.begin(), s.end(), greater<>());

    dp[x] = 1;
    for(ll k=1; k<=n; k++) {
        vector<ll> pre(x+1);
        swap(dp, pre);

        for(ll i=0; i<=x; i++) {
            (dp[i%s[k-1]] += pre[i]) %= MOD;
            (dp[i] += pre[i]*(n-k)) %= MOD;
        }
    }

    {
        ll s = 0;
        for(ll i=0; i<=x; i++)
            (s += dp[i]*i) %= MOD;
        cout << s << endl;
    }
}

#include <bits/stdc++.h>

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define LL long long

int N,X;
const int maxn = 201;
const int maxm = 100005;
const int modu = 1e9+7;
int dp[2][maxm];

vector<int> vi;

int mult(int a,int b){
    LL c = a;c *= b;c %= modu;return c;
}

int add(int a,int b){
    LL c = a;c += b;c %= modu;return c;
}

int get_int(){int x;scanf("%d",&x);return x;}
double get_double(){double x;scanf("%lf",&x);return x;}
long long get_long(){long long x;scanf("%lld",&x);return x;}

void init(){
    vi.clear();
    _for(i,0,maxm) dp[0][i] = 0;
}

int main(){
    scanf("%d %d",&N,&X);
    init();
    _for(i,0,N){
        int s = get_int();
        vi.push_back(s);
    }
    sort(ALL(vi),greater<int>());
    dp[0][X] = 1;
    int t = 0;

    _for(i,0,N){
        _for(j,0,maxm){
            dp[t^1][j] = 0;
        }

        _for(j,0,maxm){
            if(dp[t][j]){
                //printf("%d\n",j);
                dp[t^1][j%vi[i]] = add(dp[t][j],dp[t^1][j%vi[i]]);
                dp[t^1][j] = add(dp[t^1][j],mult(dp[t][j],(N-i-1)));
            }
        }
        t= t^1;
    }

    int ans = 0;

    _for(i,1,maxm){
        if(dp[t][i] > 0){
            //printf("%d %d\n",i,dp[t][i]);
            ans = add(ans,mult(i,dp[t][i]));
        }
    }
    printf("%d\n",ans);
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define ff first
#define ss second
#define p pair<int,int>
#define pb push_back
#define endl '\n'
#define w(t) ll test;cin>>test;while(test--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define pi acos(-1)
struct str{
    int ax,ay,bx,by;
};
int main()
{
    fast;
    int h,w;
    cin>>h>>w;
    vector<str>ans;
    int a[h+5][w+5];
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
           cin>>a[i][j];

        }
    }
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w-1;j++)
        {
            if(a[i][j]&1)
            {
                a[i][j+1]++;
                ans.pb({i+1,j+1,i+1,j+2});
            }
            else continue;
        }
        if(i==h-1)continue;
        if(a[i][w-1]&1)
        {
            a[i+1][w-1]++;
            ans.pb({i+1,w,i+2,w});
        }
    }
    cout<<ans.size()<<endl;
    for(auto i:ans)
    {
        cout<<i.ax<<" "<<i.ay<<" "<<i.bx<<" "<<i.by<<endl;
    }
}

#include <bits/stdc++.h>
#define ri register
#define int long long
using namespace std; const int N=200010;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
int h,w;
char s[60][60];
signed main()
{
    h=read(), w=read();
    for(ri int i=1;i<=h;i++) scanf("%s",s[i]+1);
    for(ri int i=1;i<=h;i++)
    for(ri int j=1;j<=w;j++)
    if(s[i][j]=='#')
    {
        if(s[i-1][j]!='#'&&s[i+1][j]!='#'&&s[i][j-1]!='#'&&s[i][j+1]!='#')
        {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define int         int64_t
#define ii          pair<int,int>
#define dd          pair<double,double>
#define vi          vector<int>
#define pb          push_back
#define all(x)      (x).begin(), (x).end()
#define checkBit(v, p)      (v&(1LL << p))
#define loop(i,a,b) for(int i = a;i < int(b);i++)
#define x           first
#define y           second
#define chkmin(a,b) (a) = min((a), (b))
#define chkmax(a,b) (a) = max((a), (b))
using namespace std;
int inf = 1e9, mod = 1e9;
vi ps;
inline int sum(int l, int r)
{
    return ps[r + 1] - ps[l];
}

inline int diff(int l, int mid, int r)
{
    return abs(sum(mid, r) - sum(l, mid - 1));
}

int32_t main()
{
    ios_base::sync_with_stdio(false); cout << fixed <<setprecision(0);
    int n; cin >> n;
    ps.resize(n + 1);
    ps[0] = 0;
    vi arr(n);
    for (int i=0;i<n;i++) cin >> arr[i], ps[i + 1] = ps[i] + arr[i];
    vi l(n, -1),r(n, -1);
    l[1] = 1;
    r[n - 2] = n - 1;
    for(int i = 2,ind = 1, s; i < n;i++)
    {
        s = diff(0, ind, i);
        while(ind <= i && s > diff(0, ind + 1, i)) s = diff(0, ++ind, i);
        l[i] = ind;
    }

    for(int i = n - 3,ind = n - 1, s; i >= 0;i--)
    {
        s = diff(i, ind, n - 1);
        while(ind > i && s > diff(i, ind - 1, n - 1)) s = diff(i, --ind, n - 1);
        r[i] = ind;
    }
    int mini = 2e18;
    for(int i = 2; i < n - 1;i++)
    {
        vi vals(4);
        vals[0] = sum(0, l[i - 1] - 1);
        vals[1] = sum(l[i - 1], i - 1);
        vals[2] = sum(i, r[i] - 1);
        vals[3] = sum(r[i], n - 1);
        mini = min(mini, *max_element(all(vals)) - *min_element(all(vals)));
    }
    cout << mini << endl;
    return 0;
}

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}

    ll N; cin>>N;
    ll ans=INF;
    string s; cin>>s;
    vector<ll> L(sz(s),0);
    vector<ll> R(sz(s),0);
    // 0 1 2 3 ...  sz(s)-1
    rep1(i,sz(s)-1){
        L[i]=L[i-1];
        if(s[i-1]=='W') L[i]++;
    }
    rrep(i,sz(s)-1){
        R[i]=R[i+1];
        if(s[i+1]=='E') R[i]++;
    }

    rep(i,sz(s)){
        chmin(ans,L[i]+R[i]);
    }
    cout<<ans<<endl;
}


#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

vector<P> test[15];

int main() {
    int n;
    cin >> n;
    rep(i,n) {
        int a;
        cin >> a;
        rep(j,a) {
            int x, y;
            cin >> x >> y;
            x--;
            test[i].emplace_back(x,y);
        }
    }

    int ans = 0;
    rep(is,1<<n) {
        int cnt = __builtin_popcount(is);
        bool ok = true;
        rep(i,n) {
            if (is>>i&1) {
                for (auto p : test[i]) {
                    int x = p.first, y = p.second;
                    int t = is>>x&1;
                    if (t != y) ok = false;
                }
            }
        }
        if (ok) ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

#include <cstdio>
#include <vector>

using namespace std;

struct node{
    int key;
    int parent, left, right;
    node(){ parent=-1; left=-1; right=-1; }
};

vector<node> tree;
int root=-1;

void print_pre(int id)
{
    if(id==-1){ return; }
    printf(" %d", tree[id].key);
    print_pre(tree[id].left);
    print_pre(tree[id].right);
}

void print_in(int id)
{
    if(id==-1){ return; }
    print_in(tree[id].left);
    printf(" %d", tree[id].key);
    print_in(tree[id].right);
}

void insert(int z)
{
    int y=-1;
    int x=root;
    while(x!=-1){
        y=x;
        if(tree[z].key<tree[x].key){
            x=tree[x].left;
        } else{
            x=tree[x].right;
        }
    }
    tree[z].parent=y;
    if(y==-1){
        root=z;
    } else if(tree[z].key<tree[y].key){
        tree[y].left=z;
    } else{
        tree[y].right=z;
    }
}

int find(int key)
{
    int x=root;
    while(x!=-1){
        int k=tree[x].key;
        if(key==k){
            return x;
        } else if(key<k){
            x=tree[x].left;
        } else{
            x=tree[x].right;
        }
    }
    return -1;
}

void delete_(int z)
{
    auto which=[](int z){
        auto p=&tree[tree[z].parent];
        if(p->left==z){
            return &p->left;
        } else{
            return &p->right;
        }
    };

    if(tree[z].left!=-1 && tree[z].right!=-1){
        int x=tree[z].right;
        while(tree[x].left!=-1){
            x=tree[x].left;
        }
        tree[z].key=tree[x].key;
        z=x;
    }

    if(tree[z].left==-1 && tree[z].right==-1){
        if(tree[z].parent!=-1){
            *(which(z))=-1;
        } else{
            root=-1;
        }
    } else if(tree[z].left!=-1){
        if(tree[z].parent!=-1){
            *(which(z))=tree[z].left;
        } else{
            root=tree[z].left;
        }
        tree[tree[z].left].parent=tree[z].parent;
    } else{
        if(tree[z].parent!=-1){
            *(which(z))=tree[z].right;
        } else{
            root=tree[z].right;
        }
        tree[tree[z].right].parent=tree[z].parent;
    }
}

int main()
{
    int m;
    scanf("%d", &m);
    tree=vector<node>(m);
    int n=0;
    for(int i=0; i<m; i++){
        char buf[8]; scanf("%s", buf);
        if(*buf=='i'){
            int k; scanf("%d", &k);
            tree[n].key=k;
            insert(n);
            n++;
        } else if(*buf=='f'){
            int k; scanf("%d", &k);
            printf("%s\n", find(k)!=-1 ? "yes" : "no");
        } else if(*buf=='d'){
            int k; scanf("%d", &k);
            int id=find(k);
            if(id!=-1){
                delete_(id);
            }
        } else{
            print_in(root);
            printf("\n");
            print_pre(root);
            printf("\n");
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
  vector<int > p(2);
  rep(i,2){cin >> p[i];}

  cout << p[1] + (p[1]-p[0]) << endl;

}

//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"YES"<<'\n';
#define no cout<<"NO"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  i,j,k,l,r,g;
    string a,b;
    cin>>r>>g;
    cout<<2*g-r<<endl;
       return 0;
}


#include <iostream>
#include <math.h>
using namespace std;

void factor(int n,int arr[]){
	for(int i=2;i<=n;i++){
		if(n%i==0){
			arr[i]+=1;
			factor(n/i,arr);
			break;
		}

	}
}

int main() {
	int n;
	cin>>n;
	int arr[n+1]={0};
	for(int i=1;i<=n;i++){
		factor(i,arr);
	}
	long int result=1;
	for(int i=0;i<=n;i++){
		if(arr[i]>0){
			result*=arr[i]+1;
			result=result%(1000000000+7);
		}
   }
   cout<<result;

}

#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};

map<ll, int> res;

void factorize(ll n) {
    for (int i=2; i*i<=n; i++) {
        while (n%i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) ++res[n];
}

int main() {
    ll n; cin >> n;
    REP(i,2,n+1) factorize(i);
    ll ans = 1;
    rep(i,n+1) {
        ans *= res[i]+1;
        ans %= mod;
    }
    // for (auto x : res) {
    //     ans *= x.second+1;
    //     ans %= mod;
    // }
    cout << ans << endl;
}


#include "bits/stdc++.h"
#define ll long long
#define lld long double
#define MOD 998244353
#define inf 1000000000
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x,ll y, ll md=inf){ll res = 1;x%=md;while(y){if(y&1)res = (res*x)%md;x *= x; if(x>=md) x %= md; y >>= 1;}return res;}

using namespace std;

#define endl '\n'
#define int ll

signed main() {
	fast;

	int n;
	cin>>n;
	vector<pair<pii,char>> v(n);

	for(int i=0;i<n;i++) cin>>v[i].f.f>>v[i].f.s>>v[i].s;

	map<int,set<int>> mn1, mn2;

	int f = 1;
	int ans = inf;

	for(int i=0;i<n;i++) {
		if(v[i].s=='U') {
			mn1[v[i].f.f].insert(v[i].f.s);
		}

		if(v[i].s=='R') {
			mn2[v[i].f.s].insert(v[i].f.f);
		}
	}

	for(int i=0;i<n;i++) {
		if(v[i].s=='D') {
			auto it = mn1[v[i].f.f].lower_bound(v[i].f.s);
			if(it!=mn1[v[i].f.f].begin()) {
				it--;
				f = 0;
				ans = min(ans, 5*(v[i].f.s-*it));
			}
		}
		if(v[i].s=='L') {
			auto it = mn2[v[i].f.s].lower_bound(v[i].f.f);
			if(it!=mn2[v[i].f.s].begin()) {
				it--;
				f = 0;
				ans = min(ans, 5*(v[i].f.f-*it));
			}
		}
	}

	sort(all(v));

	map<int,int> st[4];
	for(int i=0;i<n;i++) {
		int x = v[i].f.f + v[i].f.s;

		if(v[i].s=='U' && st[3].count(x)) {
			f = 0;
			ans = min(ans, 10*abs(v[i].f.f-st[3][x]));
		}
		if(v[i].s=='L' && st[1].count(x)) {
			f = 0;
			ans = min(ans, 10*abs(v[i].f.f-st[1][x]));
		}

		if(v[i].s=='U') st[0][x] = v[i].f.f;
		if(v[i].s=='D') st[1][x] = v[i].f.f;
		if(v[i].s=='L') st[2][x] = v[i].f.f;
		if(v[i].s=='R') st[3][x] = v[i].f.f;
	}

	map<int,int> dt[4];
	for(int i=0;i<n;i++) {
		int x = v[i].f.f - v[i].f.s;

		if(v[i].s=='D' && dt[3].count(x)) {
			f = 0;
			ans = min(ans, 10*abs(v[i].f.f-dt[3][x]));
		}
		if(v[i].s=='L' && dt[0].count(x)) {
			f = 0;
			ans = min(ans, 10*abs(v[i].f.f-dt[0][x]));
		}

		if(v[i].s=='U') dt[0][x] = v[i].f.f;
		if(v[i].s=='D') dt[1][x] = v[i].f.f;
		if(v[i].s=='L') dt[2][x] = v[i].f.f;
		if(v[i].s=='R') dt[3][x] = v[i].f.f;
	}

	if(f) cout<<"SAFE";
	else cout<<ans;
}

#include <stdio.h>
#include <string.h>
int main (){
	char a[3][35];
	int length [3];
	for (int i = 0;i<3;i++){
	scanf ("%s", a[i]);
	length[i]=strlen(a[i]);
	}
	if(a[0][length[0]-1]== a[1][0] &&a[1][length[1]-1]==a[2][0]){
		printf("YES");
	}else{
		printf("NO");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int N;
    cin >> N;
    map<int, int> mp;
    bool is = true;
    rep(i, N){
        int a;
        cin >> a;
        if(mp.count(a) != 0){
            is = false;
            break;
        }else{
            mp[a]++;
        }
    }
    if(is) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

#include <bits/stdc++.h>
#include <cstdlib>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  string ans="YES";
  map<int, int> hoge;

  rep(i,N) {
    cin >> A[i];
    if(hoge[A[i]] == 1) ans="NO";
    else hoge[A[i]] = 1;
  }

  cout << ans << endl;

  return 0;
}


/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}

int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;

     n=3;

     ll ara[n+2];

     input(ara,n);

     sort(ara,ara+n);

     cout<<ara[0]+ara[1]<<endl;

}

#include <bits/stdc++.h>
using namespace std;

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
  pr(b);
}

int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  pr((a + b + c) - max(a, max(b, c)));

  return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

int main(){
    ll n, q;
    cin >> n >> q;

    char s[n];
    ll rui[n+1] = {};
    rep(i, n){
        cin >> s[i];
        if(i == 0)continue;

        rui[i+1] = rui[i];
        if(s[i] == 'C' && s[i-1] == 'A')rui[i+1]++;
    }

    rep(i, q){
        ll l, r;
        cin >> l >> r;

        cout << rui[r] - rui[l] << endl;
    }
}

#include<iostream>
#include<vector>
using namespace std;

typedef long long ll;

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);

    int n, q, l, r;
    string s;
    cin >> n >> q >> s;

    vector<int> ac(n + 1, 0);

    for (int i = 1; i < n; i++) {
        if (s[i-1] == 'A' && s[i] == 'C') ac[i] = ac[i-1] + 1;
        else ac[i] = ac[i-1];
    }

    vector<int> ans(q, 0);
    for (int i = 0; i < q; i++) {
        cin >> l >> r;
        ans[i] = ac[r-1] - ac[l-1];
    }

    for (int i = 0; i < q; i++) cout << ans[i] << endl;

}


#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

int main()
{
	int n, q;
	int count = 0;
	int s[10000];
	int t[500];

	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		cin >> t[i];
	}

	for (int i = 0; i < q; i++)
	{
		int j = 0;
		while (true)
		{
			if (t[i] == s[j])
			{
				count++;
				break;
			}
			if (j == n)
			{
				break;
			}
			j++;
		}
	}

	cout << count << endl;

	return 0;
}

#include <cstdio>

int main(){
	int n;
	int a[3];
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	for(int i = 1; i <= 100000000; i++){
		bool ok = true;
		for(int j = 0; j < n; j++){
			if(a[j]%i != 0) ok = false;
		}
		if(ok) printf("%d\n", i);
	}
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int a,b; cin >> a >> b;
  string s; cin >> s;

  bool ok = true;
  if(s.size()!=a+b+1) ok = false;

  a--;b--;
  rep(i,s.size()){
    if(i==a+1 && s[i]!='-') ok =false;
    if(i!=a+1 && s[i]-'0'<0 || s[i]-'0'>9) ok = false;
  }

  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
  string A, B, S;
  cin >> A >> B >> S;
  cout << ((regex_match(S, regex("\\d{" + A + "}-\\d{" + B + "}"))) ? "Yes" : "No") << "\n";
}


#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int n;
bool solve(vi &a){
	int e = 0, oi, one = 0;
	ll sum = 0;
	rep(i, n){
		if(a[i] % 2 == 0) e++;
		else oi = i;

		if(a[i] == 1) one++;
		sum += a[i] - 1;
	}

	if(one) return sum % 2;
	if(e % 2) return 1;

	if(e == n - 1){
		a[oi]--;
		int g = a[0];
		for(int i : a) g = __gcd(i, g);
		for(int &i : a) i /= g;
		return !solve(a);
	}
	return 0;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	cin >> n;
	vi a(n); rep(i, n) cin >> a[i];
	cout << (solve(a) ? "First" : "Second") << endl;

	return 0;
}

#include<iostream>
#include<vector>
using namespace std;

vector<long> dp;
vector<long> pre;

void rec(int i, vector<int>& nottaken, long scoresofar, int mask, int group)
{
  if(i==nottaken.size())
  {
    dp[mask]=max(dp[mask],scoresofar+pre[group]);
    return;
  }
  rec(i+1,nottaken,scoresofar,mask,group);
  rec(i+1,nottaken,scoresofar,mask^(1<<nottaken[i]),group^(1<<nottaken[i]));

}

int main(){
  int n;
  cin>>n;
  vector<vector<long>> a(n,vector<long>(n));
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<n;j++)
      cin>>a[i][j];
  }

  pre.resize(1<<n);
  for(int mask=0;mask<(1<<n);mask++)
  {
    for(int i=0;i<n;i++)
    {
      if(mask&(1<<i))
      {
        for(int j=i+1;j<n;j++)
        {
          if(mask&(1<<j))
            pre[mask]+=a[i][j];
        }
      }
    }
  }

  dp.resize(1<<n,-99999999);
  dp[0]=0;
  for(int mask=0;mask<(1<<n);mask++)
  {
    vector<int> nottaken;
    for(int i=0;i<n;i++)
    {
      if(!(mask&(1<<i)))
         nottaken.push_back(i);
    }
    rec(0,nottaken,dp[mask],mask,0);
  }
  cout<<dp[(1<<n)-1];

}


#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
int dp[111][111],n,L[111],R[111];

int dfs(int l,int r){
	if(dp[l][r]!=-1)return dp[l][r];
	if(l==r)return dp[l][r]=0;
	int res=1e17;
	for(int i=l;i<r;i++){
		res=min(res,dfs(l,i)+dfs(i+1,r)+L[l]*R[i]*R[r]);
	}
	return dp[l][r]=res;
}

signed main(){
	memset(dp,-1,sizeof(dp));
	cin>>n;
	r(i,n)cin>>L[i]>>R[i];
	dfs(0,n-1);
	cout<<dp[0][n-1]<<endl;
}


#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main()
{
	int n;
	while (cin>>n)
	{
		if (n == 0)break;
		int data[11][11] = { 0 };

		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				cin >> data[i][j];
			}
		}

		for (int i = 0; i < n; i++)          //??????????¨????
		{
			for (int j = 0; j < n; j++)
			{
				data[i][n] += data[i][j];
			}
		}

		for (int i = 0; i < n; i++)           //??????????¨????
		{
			for (int j = 0; j < n+1; j++)     //n??????????????????
			{
				data[n][j] += data[i][j];
			}
		}

		for (int i = 0; i < n+1; i++)
		{
			for (int j = 0; j < n+1; j++)
			{
				cout.width(5);
				cout << data[i][j];
			}
			cout << endl;
		}
	}

	return 0;
}

#include <stdio.h>
#include <string.h>
#include <string>
#include <iostream>
#include <vector>
#include <sstream>
#include <memory>
#include <iomanip>

std::vector<int> parse_line(std::string const& line) {
    using namespace std;
    vector<int> result;
    istringstream s(line);
    string element;
    while (getline(s, element, ' ')) {
        stringstream buf;
        int value = 0;
        buf << element;
        buf >> value;
        result.push_back(value);
    }
    return std::move(result);
}
int main(int argc, char* argv[])
{
    using namespace std;
    while (true) {
        string line;
        getline(std::cin, line);
        auto elements = parse_line(line);
        auto length = elements[0];
        if (length == 0) break;
        vector<int> total(length + 1);
        size_t width = length + 1;
        for (size_t i = 0; i < length; ++i) {
            getline(cin, line);
            elements = parse_line(line);
            int sum = 0;
            for (size_t n = 0; n < length; ++n) {
                int val = elements[n];
                sum += val;
                total[n] += val;
                cout << setw(5) << val;
            }
            cout << setw(5) << sum << endl;
            total[length] += sum;
        }
        for (size_t i = 0; i < width; ++i) {
            cout << setw(5) << total[i];
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;

#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
const double pi = 3.14159265358979;

vector<pair<ll, ll>> pf(ll n){
    vector<pair<ll, ll>> res;
    for (ll i = 2; i*i <= n; i++){
        if (n%i != 0){
            continue;
        }
        else{
            ll ex = 0;
            while (n%i == 0){
                ex++;
                n /= i;
            }
            res.push_back({i, ex});
        }
    }
    if (n != 1){
        res.push_back({n, 1});
    }
    return res;

    //素因数分解
    //入力:ll
    //出力:vector<pair<ll, ll>>
    //res[i].first == i番目に小さい素因数
    //res[i].second == res[i].firstの指数
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll a,b;
    cin >> a >> b;

    ll g = gcd(a,b);

    vector<pair<ll, ll>> x = pf(g);

    cout << x.size()+1 << endl;

}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repe(i,n) for(int i=0;i<n;i++)
#define repa(i,j,n) for(int i=j;i<n;i++)
//#define v.all() v.begin(),v.end()
#define repr(i,n) for(int i=n;i>=0;i--)
#define int long long int
#define vi vector<int>
#define vpi vector<pair<int,int>>
int gcd(int a,int b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
vi primef(int n){
	vi a,ref;
	a.push_back(1);
	while(n%2==0) {
		a.push_back(2);
		n/=2;
	}
	for(int i=3;i<=sqrt(n);i+=2){
		while(n%i==0){
			a.push_back(i);

			n/=i;
		}
	}
	if(n>2) a.push_back(n);
	sort(a.begin(), a.end());
	ref.push_back(a[0]);
	for(int i=1;i<a.size();i++){
		if(a[i]!=a[i-1]) {
			ref.push_back(a[i]);
		}
	}
	return ref;
}

signed  main(){
	int t=1;
	//cin>>t;
	while(t--) {
		int ai,bi;
		cin>>ai>>bi;
		vi a,b;
		a=primef(ai);
		b=primef(bi);
		// for(int i=0;i<a.size();i++){
		// 	cout<<a[i]<<" ";
		// }
		// cout<<endl;
		// for(int i=0;i<b.size();i++){
		// 	cout<<b[i]<<" ";
		// }
		// cout<<endl;
		int ct=0;
		map<int,int> m;
		rep(i,a.size()) m[a[i]]=0;
		rep(i,b.size()) m[b[i]]=0;
		rep(i,a.size()) m[a[i]]=1;
		rep(i,b.size()){
			if(m[b[i]]==1) {ct++;}
		}
		cout<<ct<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000007
using namespace std;

int main(){
  long n;
  cin >> n;
  string ans = "";
  while(n){
    if(n%2==0){
      ans.push_back('0');
    }else{
      ans.push_back('1');
      n -= 1;
    }
    n /= (-2);
  }
  if(int(ans.size())==0)ans.push_back('0');
  rep(i,int(ans.size())){
    cout << ans[int(ans.size())-1-i];
  }
  cout << endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
class UnionFind
{
public:
  int par[100005];
  int depth[100005];
  int nGroup[100005];

  UnionFind(int n) {
    init(n);
  }

  void init(int n) {
    for(int i=0; i<n; i++) {
      par[i] = i;
      depth[i] = 0;
      nGroup[i] = 1;
    }
  }

  int root(int x) {
    if(par[x] == x) {
      return x;
    } else {
      return par[x] = root(par[x]);
    }
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return;

    if(depth[x] < depth[y]) {
      par[x] = y;
      nGroup[y] += nGroup[x];
      nGroup[x] = 0;
    } else {
      par[y] = x;
      nGroup[x] += nGroup[y];
      nGroup[y] = 0;
      if(depth[x] == depth[y])
        depth[x]++;
    }
  }
};
const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
ll n; cin>>n;
if(n==0) cout << 0 << endl;
else{
ll ca = 0;
ll k = 1;
ll m = 0;
if(n>0){
while(1){
ca+=k;
if(ca>=n){
n-=k;
break;}
m+=2;
k*=4;
}
}
else{
k = -2;
m++;
while(1){
ca+=k;
if(ca<=n){
n-=k;
break;}
m+=2;
k*=4;
}
}
ll a[m+1]={};
a[m]=1;
ll mm = 0;
//cout << n << endl;
while(1){
if(n==0)break;
if(n>0){
k = 1;
mm = 0;
ca = 0;
while(1){
ca+=k;
if(ca>=n){
break;}
mm+=2;
k*=4;
}
a[mm]++;
n-=k;
continue;
}
else{
k = -2;
mm = 1;
ca = 0;
while(1){
ca+=k;
if(ca<=n){
break;}
mm+=2;
k*=4;
}
a[mm]++;
n-=k;
continue;
}
}
rep(i,m+1){
cout << a[m-i];}
}}


#include <bits/stdc++.h>

#define debug(var)  do{std::cerr << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cerr << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cerr << e << " "; } std::cerr << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> v1;
typedef vector<v1> v2;
typedef vector<v2> v3;

typedef unordered_map<ll, unordered_map<ll, ll>> graph;

const ll INF = 1ll << 50;
const ll mod = 1000000007;

ll n;
v1 a;
v3 dp;
ll bias = 3;

int main(){
    cin >> n;
    a = v1(n);
    for(ll i = 0;i < n;i++){
        cin >> a[i];
    }
    dp = v3(2, v2(6, v1(n+1, -INF)));
    dp[0][3][0] = 0;
    for(ll i = 0;i < n;i++){
        for(ll j = 0;j < 2;j++){
            for(ll k = -2;k <= 1;k++){
                ll x = k + bias;
                if(j == 0){
                    chmax(dp[0][x-1][i+1], dp[j][x][i]);
                    chmax(dp[1][x+1][i+1], dp[j][x][i] + a[i]);
                }else{
                    chmax(dp[0][x-1][i+1], dp[j][x][i]);
                }
            }
        }
    }
    ll d = n/2 - (n-n/2);
    cout << max(dp[0][d+bias][n], dp[1][d+bias][n]) << endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e17;
const int N=2e5+10;
int a[N];
ll f[N],c1[N],c2[N];
int n;
int main() {
	ll ans,cnt;
	int i;
	ans=-INF;
	scanf("%d",&n);
	for (i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		if (i==1) c2[i]=a[i];
		else if (i%2==0) c1[i]=c1[i-2]+a[i];
		else c2[i]=c2[i-2]+a[i];
	}
	for (i=2;i<=n;i++) {
		if (i%2==0) f[i]=max(f[i-2]+a[i],c2[i-1]);
		else f[i]=max(f[i-2]+a[i],f[i-1]);
//		cout<<i<<' '<<f[i]<<endl;
	}
	printf("%lld\n",f[n]);
	return 0;
}


#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>
#include <stack>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator<< (ostream &out, const vector<int> &b) {
    for (auto k : b) out << k << " ";
    return out;
}

istream& operator>> (istream& in, pii& b) {
    in >> b.first >> b.second;
    return in;
}

ostream& operator<< (ostream& out, const pii& b) {
    out << "{" << b.first << ", " << b.second << "}";
    return out;
}

template <typename T1, typename T2> inline bool chkmin(T1 &x, const T2 &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T1, typename T2> inline bool chkmax(T1 &x, const T2 &y) {if (x < y) {x = y; return 1;} return 0;}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 10;
#else
    #define dbg(x) 57
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 179;
#endif

const ld PI = acos(-1);

#define time clock() / (double) CLOCKS_PER_SEC

// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,sse3,sse4")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("avx2")
// #pragma GCC optimize("section-anchors")
// #pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
// #pragma GCC optimize("vpt")
// #pragma GCC optimize("rename-registers")
// #pragma GCC optimize("move-loop-invariants")
// #pragma GCC optimize("unswitch-loops")
// #pragma GCC optimize("function-sections")
// #pragma GCC optimize("data-sections")

mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

const int MAXN = 1e5 + 10;

int n, k;
vector<int> g[MAXN];
int ans = 0;
int d[MAXN];

void dfs(int v) {
    d[v] = 0;
    for (auto u : g[v]) {
        dfs(u);
        if (d[u] == k - 1 && v != 0) {
            ans++;
        } else {
            chkmax(d[v], d[u] + 1);
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }
    if (k == 1) {
        for (int i = 0; i < n; i++) {
            if (a[i] != 0) {
                ans++;
            }
        }
        cout << ans << "\n";
        return 0;
    }
    if (a[0] != 0) {
        ans++;
        a[0] = 0;
    }
    for (int i = 1; i < n; i++) {
        g[a[i]].pb(i);
    }
    dfs(0);
    cout << ans << "\n";
}
/*

*/

#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 305
using namespace std;

int n, k, dp[N][N][N];
char s[N];

int f(int bas, int son, int k){
	if(bas == son)
		return 1;
	if(bas > son)
		return 0;
	int &r = dp[bas][son][k];
	if(r != -1)
		return r;
	if(s[bas] == s[son])
		r = f(bas + 1, son - 1, k) + 2;
	if(k)
		r = max(r, f(bas + 1, son - 1, k - 1) + 2);
	r = max(r, f(bas + 1, son - 1, k));
	r = max(r, f(bas, son - 1, k));
	r = max(r, f(bas + 1, son, k));
	return r;
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	memset(dp, -1, sizeof dp);
	scanf("%s %d",s + 1, &k);
	n = strlen(s + 1);
	printf("%d\n", f(1, n, k));
	return 0;
}


#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9)+7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n) {
  vector< pair<ll, ll> > p;
  for (ll i = 2; i * i <= n; i++) {
    if ((n % i) != 0) continue;
    p.push_back(make_pair(i, 0));
    while ((n % i) == 0) {
      n /= i;
      p[i].second += 1;
    }
    p.push_back(make_pair(n, 0));
  }

  if (n != 1) p.push_back(make_pair(n, 1));
  return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a) {
	ll b = MOD, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0) { u += MOD; }
	return u;
}
// 順列
ll permutation(const ll n, const ll m) {
	ll result = 1;
	for (ll i = n; i > n - m; i--) { result = (result * i) % MOD; }
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x) {
	if (x == 0) return 1;
	ll res = repeat_square(n, x/2);
	res = res * res % MOD;
	if ((x % 2) == 1) res = res * n % MOD;
  return res;
}
// 組み合わせ
ll combination(const ll n, const ll a) {
	ll x = 1, y = 1;
  for(ll i = 0; i < a; i++){
    x = x * (n-i) % MOD;
    y = y * (i+1) % MOD;
  }
  return x * repeat_square(y, MOD-2) % MOD;
}

int main() {
	ll x;
	cin >> x;

	ll n = x / 11; // (5,6) or (6,5) のペア数でわる
	ll m = x % 11; // 残りの数
	ll result = n*2;

	int min = 1000000;
	rep(i, 2) { // 1, 6 始まりとそれ以外でパターンを分ける
		int count = 0, temp = m;
		bool flag = true;
		while (temp > 0) {
			if (i == 0) { // 1, 6 始まり
				temp -= flag ? 5 : 6;
			} else { // それ以外
				temp -= flag ? 6 : 5;
			}
			count++;
			flag = !flag;
		}
		if (min > count) min = count;
	}

	cout << (result + min) << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

namespace IO {
    #define gc getchar()
    template <typename T>
    inline void read(T& x) {
        x = 0; bool f = 1; char ch;
        for (ch = gc; ch < '0' || '9' < ch; ch = gc) if (ch == '-') f ^= 1;
        for (; '0' <= ch && ch <= '9'; ch = gc) x = (x << 3) + (x << 1) + (ch ^ 48);
        x = f ? x : -x;
    }
    #undef gc
}

const int MAXN = 2e5 + 10;

int n, arr[2][MAXN], cnt[2][MAXN], val;
vector<int> pos;

int main() {
    IO::read(n);
    rep(_, 0, 1) rep(i, 1, n) IO::read(arr[_][i]), cnt[_][arr[_][i]]++;
    reverse(arr[1] + 1, arr[1] + n + 1);
    rep(i, 1, n) if (arr[0][i] == arr[1][i]) val = arr[0][i], pos.push_back(i);
    int l = 1, r = n; bool flg = false;
    for (auto cur_pos : pos) {
        if (flg == false) {
            if (arr[0][l] != val && arr[1][l] != val) {
                swap(arr[1][l], arr[1][cur_pos]);
                ++l;
            } else flg = true;
        }
        if (flg == true) {
            if (arr[0][r] != val && arr[1][r] != val) {
                swap(arr[1][r], arr[1][cur_pos]);
                --r;
            } else return puts("No"), 0;
        }
    }
    puts("Yes");
    rep(i, 1, n) printf("%d ", arr[1][i]);
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<long long> x(n);
	vector<long long> y(m);
	for (auto i = 0; i < n; ++i)
	{
		cin >> x[i];
	}
	for (auto i = 0; i < m; ++i)
	{
		cin >> y[i];
	}

	auto sumX = 0ll;
	auto mod = (long long)1e9 + 7;
	for (auto i = 1; i < n; ++i)
	{
		auto diff = x[i] - x[i - 1];
		sumX += (((diff * i) % mod) * (n - 1 - i + 1)) % mod;
		sumX %= mod;
	}

	auto sum = 0ll;
	for (auto i = 1; i < m; ++i)
	{
		auto diff = y[i] - y[i - 1];
		sum += (((((diff * i) % mod) * (m - 1 - i + 1)) % mod) * sumX) % mod;
		sum %= mod;
	}

	cout << sum << endl;

	return 0;
}

#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<memory.h>
using namespace std;
typedef long long ll;
const int Max = 4e5 + 5;

int lst[Max];

int main()
{
	int n, x;
	cin >> n >> x;
	for (int i = 1;i <= n;i++)
	{
		scanf("%d", &lst[i]);
	}
	ll sum = 0;
	if (lst[1] > x)
	{
		sum = lst[1] - x;
		lst[1] = x;
	}
	for (int i = 2;i <= n;i++)
	{
		if (lst[i - 1] + lst[i] > x)
		{
			int t = lst[i] + lst[i - 1] - x;
			lst[i] -= t;
			sum += t;
		}
	}
	cout << sum << endl;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, M;
    cin >> N;
    vector<string> blue(N);
    for(int i = 0; i < N; i++){
        cin >> blue.at(i);
    }
    cin >> M;
    vector<string> red(M);
    for(int i = 0; i < M; i++){
        cin >> red.at(i);
    }
    int ans = 0;
    int maxans = 0;
    for(int i = 0; i < N; i++){
        int bcnt = 1;
        int rcnt = 0;
        for(int j = 0; j < N; j++){
            if(i == j){
                continue;
            }
            if(blue.at(i) == blue.at(j)){
                bcnt++;
            }
        }
        for(int j = 0; j < M; j++){
            if(blue.at(i) == red.at(j)){
                rcnt--;
            }
        }
        ans = bcnt + rcnt;
        if(maxans < ans){
            maxans = ans;
        }
    }
    cout << maxans << endl;
}


#include<bits/stdc++.h>
using namespace std;
void gofail(){
	cout<<"No\n";
	exit(0);
}
const int N=100100;
int a[N],b[N],c[N],sum[3*N],sum1,sum2,n;
void add(int x){for(;x;x-=x&-x)sum[x]^=1;}
int qry(int x){int ans=0;for(;x<=3*n;x+=x&-x)ans^=sum[x];return ans;}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i)cin>>a[i];
	for(int i=1;i<=n;++i)cin>>b[i];
	for(int i=1;i<=n;++i)cin>>c[i];
	for(int i=1;i<=n;++i){
		if(a[i]<b[i]){
			if(a[i]+1!=b[i])gofail();
			if(b[i]+1!=c[i])gofail();
			if(c[i]%3)gofail();
			a[i]=a[i]/3+1;b[i]=0;
		}else{
			if(a[i]-1!=b[i])gofail();
			if(b[i]-1!=c[i])gofail();
			if(a[i]%3)gofail();
			a[i]=a[i]/3;b[i]=1;
		}
		if((a[i]^i)&1)gofail();
		if(i&1)sum2^=b[i];
		else sum1^=b[i];
	}
	for(int i=1;i<=n;i+=2){
		sum1^=qry(a[i]);
		add(a[i]);
	}
	memset(sum,0,sizeof sum);
	for(int i=2;i<=n;i+=2){
		sum2^=qry(a[i]);
		add(a[i]);
	}
	if(sum1||sum2)gofail();
	cout<<"Yes\n";
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main(){
  vector<int> outp;
  int icn;
  int icd;
  int g;
  vector<int> ice;
  for(g = 0;;g++){
    vector<int> ice(10,0);
    cin >> icn;
    if(icn == 0){
      break;
    }else{
    for(int a = 0;a< icn;a++){
      cin >> icd;
      ice[icd] += 1;
    }
    outp.insert(outp.end(),ice.begin(),ice.end());
  }
  }
  for(int n = 0;n<g * 10;n++){
    if(outp[n] == 0){
      cout << "-";
    }else{
      for(int c = 0;c<outp[n];c++){
        cout << "*" ;
      }
    }
    cout << endl;
  }
  return 0;
}

// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define fastIO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
int INPUT_INT() { int d; cin >> d; return d; } // 入力をpush_back(d)やarray[d]に使う時に無駄な変数を使わない

// ------------------- include, typedef, define END. -------------------

void solve(VI in){
	FOR(i, 0, in.size()){
		if (in[i]){
			while (in[i]--){
				cout << "*";
			}
			cout << endl;
		}
		else{
			cout << "-" << endl;
		}
	}
}

int main(){
	int n;
	while (cin >> n,n){
		VI input(10,0);
		FOR(i, 0, n){
			input[INPUT_INT()]++;
		}
		solve(input);
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

// 約数の列挙 O(√n)
vector<ll> divisor(ll n) {
    vector<ll> res;

    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }

    return res;
}

int main() {
    INIT;

    ll N;
    cin >> N;
    vector<ll> a(N + 1, 0);
    reps(i, 1, N + 1) cin >> a[i];

    vector<ll> b;
    vector<ll> sum(N + 1, 0);
    ll ans = 0;

    for (ll i = N; i > 0; i--) {
        if (sum[i] % 2 != a[i]) {
            b.pb(i);
            vector<ll> divs = divisor(i);
            rep(j, SZ(divs)) { sum[divs[j]]++; }
        }

        // cout << i << ": ";
        // repv(sum) cout << *it << " ";
        // cout << endl;
    }

    sort(ALL(b));
    cout << SZ(b) << endl;
    if (SZ(b) > 0) {
        repv(b) { cout << *it << " "; }
        cout << endl;
    }

    return 0;
}

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#include <list>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
#define endl "\n"
#define pi 3.14159265358979
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    vi vec(N);
    rep(i, N) cin >> vec[i];
    vi ball(N, -1);
    vi ans;
    int bcnt = 0;
    for (int i = N - 1; i > -1; i--) {
        int subsum = 0;
        for (int j = 2; (i + 1) * j - 1 < N; j++) {
            int ind = (i + 1) * j - 1;
            subsum += ball[ind];
        }
        subsum %= 2;
        int to_add = subsum ^ vec[i];
        bcnt += to_add;
        ball[i] = to_add;
        if (ball[i]) {
            ans.push_back(i + 1);
        }
    }

    cout << bcnt << endl;;
    for (auto aa : ans) {
        cout << aa << " ";
    }
    cout << endl;
}


#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
#define ll long long
using namespace std;
const int N=50005;
int n,p[N],vis[N],cnt,now; ll a[505][505],v1[N],v2[N];
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
void init(int n){
	rep (i,2,n){
		if (!vis[i]) p[++cnt]=i;
		for (int j=1;j<=cnt&&i*p[j]<=n;j++){
			vis[i*p[j]]=1;
			if (i%p[j]==0) break;
		}
	}
}
int main(){
	scanf("%d",&n);
	if (n==2) return puts("4 7\n23 10"),0;
	init(10000);
	rep (i,1,n) a[i][0]=a[i][n+1]=a[0][i]=a[n+1][i]=1;
	now=1;
	for (int i=1+1;i<=n+n;i+=2) v1[i]=p[now++];
	for (int i=(n&1)?1-n:2-n;i<=n-1;i+=2) v2[i+n]=p[now++];
	rep (i,1,n) rep (j,1,n) if (!((i+j)&1)) a[i][j]=v1[i+j]*v2[i-j+n];
	rep (i,1,n) rep (j,1,n) if ((i+j)&1) a[i][j]=lcm(lcm(a[i][j-1],a[i][j+1]),lcm(a[i-1][j],a[i+1][j]))+1;
	rep (i,1,n){rep (j,1,n) printf("%lld ",a[i][j]); puts("");}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
  int m;
  cin >> m;
  vector<int> nodes;
  vector<pair<int, int>> child;
  int n = 0;
  for (int i = 0; i < m; i++){
    string q;
    cin >> q;
    if (q == "insert"){
      int k;
      cin >> k;
      if (n != 0){
        int v = 0;
        while (1){
          if (k < nodes[v]){
            if (child[v].first != -1){
              v = child[v].first;
            } else {
              child[v].first = nodes.size();
              break;
            }
          } else {
            if (child[v].second != -1){
              v = child[v].second;
            } else {
              child[v].second = nodes.size();
              break;
            }
          }
        }
      }
      nodes.push_back(k);
      child.push_back(make_pair(-1, -1));
      n++;
    }
    if (q == "find"){
      int k;
      cin >> k;
      if (n == 0){
        cout << "no" << endl;
      } else {
        int v = 0;
        while (1){
          if (k < nodes[v]){
            if (child[v].first == -1){
              cout << "no" << endl;
              break;
            } else {
              v = child[v].first;
            }
          } else if (k > nodes[v]){
            if (child[v].second == -1){
              cout << "no" << endl;
              break;
            } else {
              v = child[v].second;
            }
          } else {
            cout << "yes" << endl;
            break;
          }
        }
      }
    }
    if (q == "delete"){
      int k;
      cin >> k;
      int v = 0;
      int u;
      while (1){
        if (k < nodes[v]){
          u = v;
          v = child[v].first;
        } else if (k > nodes[v]){
          u = v;
          v = child[v].second;
        } else {
          break;
        }
      }
      if (child[v].first != -1 && child[v].second != -1){
        u = v;
        int w = child[v].second;
        while (child[w].first != -1 || child[w].second != -1){
          u = w;
          if (child[w].first != -1){
            w = child[w].first;
          } else {
            w = child[w].second;
          }
        }
        swap(nodes[v], nodes[w]);
        v = w;
      }
      if (child[v].first != -1 && child[v].second == -1){
        int w = child[v].first;
        nodes[v] = nodes[w];
        child[v].first = child[w].first;
        child[v].second = child[w].second;
      } else if (child[v].second != -1 && child[v].first == -1){
        int w = child[v].second;
        nodes[v] = nodes[w];
        child[v].first = child[w].first;
        child[v].second = child[w].second;
      } else {
        if (child[u].first == v){
          child[u].first = -1;
        } else {
          child[u].second = -1;
        }
      }
      n--;
    }
    if (q == "print"){
      //Inorder
      if (n != 0){
        stack<int> S;
        vector<int> t(nodes.size(), 0);
        S.push(0);
        while (!S.empty()){
          int v = S.top();
          S.pop();
          if (t[v] == 1){
            cout << ' ' << nodes[v];
          }
          if (t[v] == 0){
            S.push(v);
            if (child[v].second != -1){
              S.push(child[v].second);
            }
            S.push(v);
            if (child[v].first != -1){
              S.push(child[v].first);
            }
          }
          t[v]++;
        }
      }
      cout << endl;
      //Preorder
      if (n != 0){
        stack<int> S;
        vector<int> t(nodes.size(), 0);
        S.push(0);
        while (!S.empty()){
          int v = S.top();
          S.pop();
          if (t[v] == 0){
            cout << ' ' << nodes[v];
          }
          if (t[v] == 0){
            S.push(v);
            if (child[v].second != -1){
              S.push(child[v].second);
            }
            S.push(v);
            if (child[v].first != -1){
              S.push(child[v].first);
            }
          }
          t[v]++;
        }
      }
      cout << endl;
    }
  }
}


/*
** author:mahmoud magdy
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

inline int D()
{
    int m ;
    cin>>m;
    return m ;
}
inline ll lD()
{
    ll m ;
    cin>>m;
    return m ;
}
inline double dD()
{
    double m;
    cin>>m;
    return m;
}
void fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int main()
{
    fast();
    int n=D();
    set<int>st;
    for(int i=0;i<n;++i){
        st.insert(D());
    }
    if(st.size()==n)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言

int main()
{
    int n;
    cin >> n;
    vector<long int>f(n);
    int i;
    string s;
    s = "YES";
    for (i = 0; i < n; i++)
    {
        cin >> f.at(i);
    }
    sort(f.begin(), f.end());
    for (i = 0; i < n - 1; i++)
    {
        if (f.at(i) == f.at(i + 1))
        {
            s = "NO";
            break;
        }
    }
    cout << s << endl;

}


/*     *******************Bismillahir Rahmanir Rahim************************
                          MD. ASFAKUL GHANI!
                          *ProMAGFAT*!
 SECRET_warning :)->FAT   CSE-25!
                          JAHANGIRNAGAR UNIVERSITY!
                          Dhaka,Bangladesh!
*/

#include <bits/stdc++.h>
#include <set>
using namespace std;

#define           fasterIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define           Im int main()
#define           ll long long
#define           sc scanf
#define           pf printf
#define           rn0 return 0
#define           rn return
#define           f0(i,n) for(ll i=0;i<n;i++)
#define           f1(i,n) for(ll i=1;i<=n;i++)
#define           f2(i,n) for(ll i=n-1;i>=0;i--)
#define           pi 2*acos(0.0)
#define           modulo 1000003
#define           dd double
#define           PI 3.14159265358979
#define           pi 2*acos(0.0)
#define           p_b push_back
#define           ps push

/*
ll for_binarySearch(ll a,ll b,ll aa[],ll x){while(a<=b){ll mid=(a+b)/2;if(aa[mid]==x) return 1;else if(aa[mid] > x) b=mid-1;else a=mid+1;}return -1;}
ll for_gcd(ll a,ll b){if(a==0) return b;else return for_gcd(b%a,a);}
ll for_prime(ll x){for (ll i=2;i*i<=x;i++){if(x%i==0) return 0;}return 1;}
void for_swap(char *x,char *y){char temp;temp=*x;*x=*y;*y=temp;}
ll for_big_mod(ll b,ll p,ll m){if(p==0) return 1;else if(p%2==0){ll k=for_big_mod(b,p/2,m);return (k*k)%m;}else return ((b%m)*(for_big_mod(b,p-1,m)))%m;}
ll for_josephus(ll n,ll k){if(n==1) return 1;return (for_josephus(n-1,k)+k-1)%n+1;}
ll for_gcdExtended(ll a,ll b,ll *x,ll *y){if(a==0){*x=0;*y=1;return b;}ll x1,y1;ll gcd=for_gcdExtended(b%a,a,&x1,&y1);*x=y1-(b/a)*x1;*y=x1;return gcd;}
*/

void debug1()
{
    cout << "***" << endl;
}

void debug11(ll n)
{
    cout << n << endl;
}

#define ipair pair <ll,ll>
#define inf 12345678912345
ll n,m,p;
vector <ipair> v1[101010];
pair <ll,ipair> pp[101010];
vector <ll> dis;

void FAT_dj(ll src)
{
    priority_queue <ipair, vector<ipair>, greater<ipair> > pq;
    pq.ps(make_pair(0,src));
    dis[src] = 0;
    while (!pq.empty()){
        ll u = pq.top().second;
        pq.pop();
        vector <ipair> ::iterator it;
        for (it = v1[u].begin(); it != v1[u].end(); it += 1){
            ll v = (*it).first;
            ll w = (*it).second;
            if (dis[v] > dis[u] + w){
                dis[v] = dis[u] + w;
                pq.ps(make_pair(dis[v],v));
            }
        }
    }
}

void FAT_Ncycle(ll src)
{
    dis[src] = 0;
    for (ll i = 0; i < n; i += 1){
        if (src == i) continue;
        for (ll j = 0; j < m; j += 1){
            ll w = pp[j].first;
            ll u = pp[j].second.first;
            ll v = pp[j].second.second;
            if (dis[u] + w < dis[v] && dis[u] != inf){
                dis[v] = dis[u] + w;
            }
        }
    }
}

Im
{
    /*#ifdef FAT
       freopen("input.txt","w",stdin);
    #endif // FAT*/

    //fasterIO;

    cin>>n>>m;

    for (ll i = 0; i < m; i += 1){
        ll u,v,w;
        cin>>u>>v>>w;
        v1[u].p_b(make_pair(v,w));
        pp[i] = make_pair(w,make_pair(u,v));
        //v1[v].p_b(make_pair(u,w));
    }

    for (ll k = 0; k < n; k += 1){
    for (ll i = 0; i <= n; i += 1) dis.p_b(inf);

    FAT_Ncycle(k);
    if (k==0){
    for (ll i = 0; i < m; i += 1){
        ll w = pp[i].first;
        ll u = pp[i].second.first;
        ll v = pp[i].second.second;
        if (dis[u] != inf && dis[u] + w < dis[v]){
            cout << "NEGATIVE CYCLE" << endl;
            rn0;
        }
    }
    }
    if (dis[0] == inf) cout << "INF";
    else cout << dis[0];
    for (ll i = 1; i < n; i += 1){
        if (dis[i] == inf) cout << " " << "INF";
        else cout << " " << dis[i];
    }
    cout << endl;
    dis.clear();
    }

    for (ll i = 0; i < n; i += 1) v1[i].clear();

   // main();

    rn0;
}

#include <bits/stdc++.h>

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
// #define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename W>
struct N003 {
   typedef std::vector<long> LI;
   typedef std::vector<W>    LW;
   long n, e;
   LI ss, ds;
   LW ws;
   std::vector<LI> iss;
   N003(long n_, const LI& ss_, const LI& ds_, const LW& ws_)
      : n(n_), e(ss_.size()), ss(ss_), ds(ds_), ws(ws_) {
      iss.resize(n+1);
      for(long i = 0; i < e; ++i) {
         iss[ss[i]].push_back(i);
      }
   }
};

template<typename W>
struct N006 {
   std::vector<std::vector<W>> xss;
   bool negativeCycle;
   N006(const N003<W>& g, W inf) : negativeCycle(false) {
      xss.resize(g.n+1);
      for(auto& xs : xss) xs.resize(g.n+1, inf);
      for(long i = 0; i < g.n+1; ++i) xss[i][i] = 0;
      for(long i = 0; i < g.e; ++i) {
         xss[g.ss[i]][g.ds[i]] = g.ws[i];
      }
      for(long z = 0; z < g.n+1; ++z) {
         for(long x = 0; x < g.n+1; ++x) {
            for(long y = 0; y < g.n+1; ++y) {
               W d = xss[x][y];
               W nd = xss[x][z] + xss[z][y];
               xss[x][y] = std::min(d, nd);
            }
         }
      }
      for(long x = 0; x < g.n+1; ++x) {
         for(long y = 0; y < g.n+1; ++y) {
            if( xss[x][y] >= inf / 2 ) {
               xss[x][y] = inf;
            }
         }
         if( xss[x][x] < 0 ) {
            negativeCycle = true;
         }
      }
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      typedef std::vector<long> LI;
      long v, e;
      scan(v, e);
      LI ss(e+1), ds(e+1);
      LI ws(e+1);
      for(long i = 0; i < e; ++i) {
         scan(ss[i], ds[i], ws[i]);
      }
      N003<long> g(v, ss, ds, ws);
      N006<long> warshallfloyd(g, (1LL << 60));
      if( warshallfloyd.negativeCycle ) {
         puts("NEGATIVE CYCLE");
      }
      else {
         for(long i = 0; i < v; ++i) {
            for(long k = 0; k < v; ++k) {
               if( warshallfloyd.xss[i][k] == (1LL << 60) ) {
                  printf("INF");
               }
               else {
                  printf("%ld", warshallfloyd.xss[i][k]);
               }
               putchar( k == v - 1 ? '\n' : ' ');
            }
         }
      }
   }
};

int main() {
  loop std::unique_ptr<Solver>(new Solver())->solve();
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int solve(int n, vector<int> & dims){
    int dp[100][101] = {{0}};
    for (int span = 2; span != n + 1; ++span){
        for (int first = 0; first + span != n + 1; ++first){
            for (int last = first + span; last != n + 1; ++last){
                int record = 2000000000;
                for (int mid = first + 1; mid != last; ++mid){
                    record = min(record, dp[first][mid] + dp[mid][last] + dims[first] * dims[last] * dims[mid]);
                }
                dp[first][last] = record;
            }
        }
    }
    return dp[0][n];
}

int main()
{
    int n = 0;
    cin >> n;
    vector<int> dims(n + 1);
    int r = 0;
    int c = 0;
    for (int i = 0; i != n; ++i){
        cin >> r >> c;
        dims[i] = r;
    }
    dims[n] = c;
    cout << solve(n, dims) << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define EPS 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define x real()
#define y imag()
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,a[105],b[105];
map<P,int>M;
typedef complex<double> pt;
bool eq(double a,double b){
  return (-EPS < a-b && a-b < EPS);
}
double dot(pt a,pt b){
	return (conj(a)*b).x;
}
double cross(pt a,pt b){
	return (conj(a)*b).y;
}
bool cmp(const pt& a,const pt& b){
	if(-EPS < a.x-b.x && a.x-b.x < EPS) return a.y < b.y;
	else return a.x < b.x;
}
int ccw(pt a,pt b,pt c){
	b -= a; c -= a;
	//cout<<cross(b,c)<<endl;
	if(cross(b,c) > EPS) return 1; // counter clockwise
	if(cross(b,c) < -EPS) return -1; // clockwise
	if(dot(b,c) < -EPS) return 2; //c-a-b
	if(norm(b) < norm(c)) return -2; //a-b-c
	return 0; //a-c-b
}
vector<pt>convex_hull(vector<pt>ps)
{
	sort(ps.begin(),ps.end(),cmp);
	int k=0,n = ps.size();
	vector<pt>qs(n*2);
	for(int i=0;i<n;i++)
	{
		while(k>1 && ccw(qs[k-2],qs[k-1],ps[i]) != 1) k--;
		qs[k++] = ps[i];
	}
	for(int i=n-2,t=k;i>=0;i--)
	{
		while(k>t && ccw(qs[k-2],qs[k-1],ps[i]) != 1) k--;
		qs[k++] = ps[i];
	}
	qs.resize(k-1);
	return qs;
}

double ans[105];
int main(){
	cin>>n;
	vector<pt>vec;
	rep(i,n){
		cin>>a[i]>>b[i];
		M[mp(a[i],b[i])] = i;
		vec.pb(pt((double)(a[i]),(double)(b[i])));
	}
	vector<pt>c = convex_hull(vec);
	if(c.size() == 2){
		int xx = floor(c[0].real()+0.5);
		int yy = floor(c[0].imag()+0.5);
		ans[M[mp(xx,yy)]] = 0.5;
		xx = floor(c[1].real()+0.5);
		yy = floor(c[1].imag()+0.5);
		ans[M[mp(xx,yy)]] = 0.5;
	}
	else{
		for(int i=0;i<c.size();i++){
			pt q = c[i];
			pt p = c[(i-1+c.size())%c.size()];
			pt r = c[(i+1)%c.size()];
			double v = arg((p-q)/(r-q));
			v = 3.141592653589 - v;
			int xx = floor(c[i].real()+0.5);
			int yy = floor(c[i].imag()+0.5);
			ans[M[mp(xx,yy)]] = v / (2.0*3.141592653589);
		}
	}
	rep(i,n){
		printf("%.12f\n",ans[i]);
	}
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = 1e+14;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define _GLIBCXX_DEBUG

int main(){
    ll N;
    cin>>N;
    vector<ll> ex(N+10, 0);
    if(N!=1){
    for (ll i=2; i<N+1; i++){
        ll onway=i; //途中の数
        for(ll a=2; a*a<=onway; a++){
            if(onway%a!=0)continue;
            while(onway%a==0){
                ex[a]++;
                onway/=a;
            }
        }
        if(onway!=1) ex[onway]++;
    }
    }
    if(N==1) cout<<1<<endl;
    else {
        ll count=1;
        for(ll i=2; i<=N; i++){
            if(ex[i]==0)continue;
            count*=ex[i]+1;
            count%=mod;
        }
        cout<<count<<endl;
    }

}

#include <bits/stdc++.h>
using namespace std;

const int MAXN = 100005;

int N;
long long A[MAXN], B[MAXN];

int main(){
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		scanf("%lld", &A[i]);
		B[i] = A[i];
	}

	long long r1 = 0, r2 = 0;
	for(int i = 59, k = 0; i >= 0; i--){
		int ind = -1, p = 0;

		for(int j = 0; j < N; j++)if(B[j] & (1LL << i))
			p ^= 1;

		for(int j = k; j < N; j++)if(A[j] & (1LL << i)){
			ind = j;
			break;
		}

		if(p == 1){
			r1 += 1LL << i;
			continue;
		}
		if(ind == -1)continue;

		swap(A[ind], A[k]);
		if(!(r2 & (1LL << i)))r2 ^= A[k];

		for(int j = k + 1; j < N; j++)
			if(A[j] & (1LL << i))A[j] ^= A[k];

		k++;
	}
	r2 &= ~r1;

	printf("%lld\n", r1 + 2 * r2);

	return 0;
}