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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vcc = vector<vc>;
using Pii = pair<int,int>;
using ld = long double;

#define rep(i,n) for(int i = 0; i<(int)n; i++)
#define per(i,n) for(int i = n-1; i>=0; i--)
#define mysort(V) sort(V.begin(),V.end())
#define myreverse(V) reverse(V.begin(),V.end())
#define myunique(V) V.erase( unique(V.begin(), V.end()), V.end() );
#define print(s) cout << s << endl;

const ld PI = 3.14159265358979;
const long long INF = 12345678909876;

long long powll(long long x, long long n){
    if(n == 0) return 1;
    else       return powll(x,n-1)*x;
}

long long gcd(long long a, long long b){
    if(a%b==0) return b;
    else return gcd(b,a%b);
}

int main(){
    int N;
    string s,t;
    cin >> N >> s >> t;
    vector<int> A(0),B(0);
    for(int i = 0; i<s.size(); i++){
        if(s[i]=='0'){
            A.push_back(i);
        }
    }
    for(int j = 0; j<s.size(); j++){
        if(t[j]=='0'){
            B.push_back(j);
        }
    }
    int ans = 0;
    if(A.size()!=B.size()){
        ans = -1;
    }
    else{
        for(int i = 0; i<A.size(); i++){
            if(A[i]!=B[i]){
                ans++;
            }
        }
    }
    cout << ans << endl;

}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
using ll = long long;
using ld = long double;

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 (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
// const ll MOD = 998244353;
const double PI=3.14159265358979323846;

int mygcd(int n, int m) {  // 最大公約数を求めるプログラム
    // nとmの最大公約数を返す関数
    if(m > n) {
        int c = n;
        n = m;
        m = c;
    }
    if(n%m == 0) return m;
    else return mygcd(m, n%m);
}

int main() {
    int n; cin >> n;
    string s, x; cin >> s >> x;
    vector<vector<int>> dp(200010, vector<int>(7));
    // dp[i][j] ... i番目の手番でT%7=jだった場合の勝敗
    // 0ならAoki, 1ならTakahashi
    dp[n][0] = 1;
    for(int i = n-1; i >= 0; i--) {
        int a = s[i] - '0';
        rp(j, 0, 7) {
            int b = (j*10 + a) % 7;
            int c = (j*10) % 7;
            if(x[i] == 'A') {
                // aと0どちらを加えても7の倍数になる場合、1
                if(dp[i+1][b] == 1 and dp[i+1][c] == 1) {
                    dp[i][j] = 1;
                }
            } else {
                if(dp[i+1][b] == 1 or dp[i+1][c] == 1) {
                    dp[i][j] = 1;
                }
            }
        }
    }
    if(dp[0][0] == 1) cout << "Takahashi" << endl;
    else cout << "Aoki" << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  pr(n-1);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}

#include <bits/stdc++.h>
using namespace std;
#define N 100010
typedef long long ll;

ll arr[N];

int main()
{
    ll n, q;
    cin >> n >> q;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    ll k;
    while (q--)
    {
        cin >> k;
        ll target = 1;
        ll left = 0, right = n - 1;
        while (left <= right)
        {
            ll middle = left + ((right - left) >> 1);
            if (arr[middle] - middle - 1 < k)
            {
                left = middle + 1;
            }
            else if (arr[middle] - middle - 1 >= k)
            {
                right = middle - 1;
            }
        }
        cout << k + target + right << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define pb push_back
#define mod 1000000007
void contest()
{
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
}
ll dmod(ll x) {return ((x + mod) % mod);}
ll modular_power(ll x, ll y)
{ll ans = 1; while (y) {if (y & 1)ans = dmod(ans * x); y /= 2; x = dmod(x * x);} return ans;}
ll inverse(ll x) {return modular_power(dmod(x), mod - 2);}
ll rotated_search(ll a[], ll l, ll h, ll key) {
  if (l > h)return -1; ll mid = (l + h) / 2; if (a[mid] == key)return mid;
  if (a[l] <= a[mid]) {
    if (key >= a[l] && key <= a[mid])return rotated_search(a, l, mid - 1, key); return rotated_search(a, mid + 1, h, key);
  }
  if (key >= a[mid] && key <= a[h])return rotated_search(a, mid + 1, h, key); return rotated_search(a, l, mid - 1, key);
}
ll knight(ll n) {return n * n * (n * n - 1) / 2 - 4 * (n - 1) * (n - 2);}
struct custom_hash
{
  static uint64_t splitmix64(uint64_t x)
  {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const
  {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
bool comp(pair<int, int> l1, pair<int, int> l2)
{
  if (l1.first < l2.first)return true;
  return false;
}
long long int tt(long long int l, long long int r)
{
  long long int temp1 = ((l) * (l + 1)) / 2;
  long long int temp2 = ((r) * (r + 1)) / 2;
  return temp2 - temp1;
}

int main()
{
  contest();
  fast
  /////   CODE BELOW    //////////
  //unordered_map<long long ll, long long ll, custom_hash> mp;

  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++)cin >> a[i];
  long long int ans = 0;
  for (int i = 0; i < n; i++)
  {
    if (a[i] > 10)
    {
      ans += (a[i] - 10);
    }
  }
  cout << ans;
}

// 10 10
// ...#..A.#.
// ....B...##
// ...#......
// ..........
// ...#.#....
// ..##..#...
// .......#..
// #.......#.
// ...#....#.
// #......#..

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
using PII = pair<int, int>;

inline void quickread() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

ll qpow(ll a, ll b, ll p) {
	ll ret = 1;
    while(b) {
        if(b & 1) ret = (ret * a) % p;
        a = (a * a) % p;
        b >>= 1;
    }
    return ret;
}

int main() {
	quickread();

	int n, ret = 0;
	cin >> n;
	VI a(n);
	for(int i =0 ; i < n; i++) {
		cin >> a[i];
		if(a[i] > 10) {
			ret += (a[i] - 10);
		}
	}
	cout << ret << endl;
	return 0;
}


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

int main() {
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	int a, b;
	int x = 1^2;
	cin >> a >> b;
	if ((x^a^b) != (1^2)) cout << (x^a^b);
	else cout << a;

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {

    int x, y;
    cin >> x >> y;
    if ( x == y ) cout << x;
    else {
        int arr[3] = {0, 1, 2};
        for ( int i = 0; i < 3; i ++ ) {
            if ( arr[i] != x && arr[i] != y ) {
                cout << arr[i];
                break;
            }
        }
    }

}


#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <math.h>
using namespace std;

int t[200001];
int main(void){
    int n;
    cin >> n;
    int at=0;
    for(int i=0;i<n;i++){
        int s;
        cin >> s;
        t[s]++;
        while(t[at]){
            //cout << ":" << at << endl;
            at++;
        }
        cout << at << endl;
    }
	return 0;
}

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

#define endl "\n"
#define int long long int
#define mod 1000000007
#define vi vector<int>
#define pint pair<int,int>
#define vint vector<vector<int>>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const int N = 1e6+5;
int A[N], B[N], P[N], Q[N][3], D[N][3];

int mat[5005][5005];
pint edges[N];
unordered_map<int, set<int>> m;

bool compare(vi a, vi b)
{
    return a[0] < b[0];
}

int lcm(int a, int b)
{
    return (a*b)/(__gcd(a,b));
}

int mypow(int a, int x)
{
    if(a<=1 || x==1) return a;
    if(x==0) return 1;

    int temp = mypow(a,x/2);
    if(x%2==0) return ((temp%mod) * (temp%mod))%mod;
    else return (a%mod * ((temp%mod) * (temp%mod))%mod)%mod;
}

int count_bits(int n)
{
    int cnt = 0;
    while(n)
    {
        n = n & (n-1);
        cnt++;
    }return cnt;
}

void bfs(int src, int n)
{
    unordered_map<int, bool> visited;
    for(int i=0;i<n;i++) visited[i] = false;
    queue<int> q;
    q.push(src);
    visited[src] = true;

    while(!q.empty())
    {
        int curr = q.front();
        q.pop();
        B[curr] -= min(B[curr], A[src]);
        //cout<<curr<<" "<<endl;

        for(auto neigh: m[curr])
        {
            if(visited[neigh] == false)
            {
                //cout<<neigh<<endl;
                q.push(neigh);
                visited[neigh] = true;
                m[src].erase(neigh);
                m[neigh].erase(src);
            }
        }
    }
}

int length_of_lis(int n)
{
    if(n<=1) return n;
    vector<int> res;

    res.push_back(A[0]);
    int i;

    for(i=1;i<n;i++)
    {
        if(A[i] > res.back()) res.push_back(A[i]);
        else
        {
            int index = lower_bound(res.begin(), res.end(), A[i]) - res.begin();
            res[index] = A[i];
        }
    }return res.size();
}

void solve(int n)
{
    bool table[n+1];
    int i,j;
    for(i=0;i<=n;i++) table[i] = false;
    vi res;

    int left = 0;
    for(i=0;i<n;i++)
    {
        if(A[i] != left)
        {
            res.push_back(left);
            if(A[i] >= 0 && A[i] <= n) table[A[i]] = true;
        }
        else
        {
            table[left] = true;
            while(table[left] != false) left++;
            res.push_back(left);
        }
    }

    for(auto x:res) cout<<x<<endl;
}

int32_t main()
{
    //code
	IOS;

    int t,n,m,a,b,x,y,i,j,z;
    //cin>>t;
    t = 1;
    while(t--)
    {
        cin>>n;
        for(i=0;i<n;i++) cin>>A[i];
        solve(n);
    }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[])
{
	int a, b, c;
	cin >> a >> b >> c;

	if(( a*a + b*b) < (c*c) ){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
}

#define LOCAL
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i,s,n) for (int i = (ll)s; i < (ll)n; i++)
#define rrep(i,n,e) for (int i = (ll)n; i > (ll)e; i--)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
// #define M_PI 3.14159265358979323846 // CF
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) cout << fixed << setprecision(10) << x << endl; // print Decimal number 10 Rank
#define endl "\n"
#define Case(x) printf("Case #%d: ", x); // gcj

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<char> vch;
typedef vector<vector<char>> vvch;

constexpr ll INF = 1001002003004005006ll;
constexpr int n_max = 2e5+10;

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; };

template<class T, class U>
T POW(T x, U n) {T ret=1; while (n>0) {if (n&1) {ret*=x;} x*=x; n>>=1;} return ret;};

// debug
template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';};
string to_string(const char c) {return to_string((string) &c);};
string to_string(bool b) {return (b ? "true" : "false");};
template <size_t N>
string to_string(bitset<N> v){
  string res = "";
  for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
  return res;
};
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for(const auto &x : v) {
    if(!first) res += ", ";
    first = false; res += to_string(x);
  }
  res += "}";
  return res;
};
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;};
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); };

void LINE_OUT() {
  cout << "--------------" << endl;
};

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define LINE LINE_OUT();
#else
#define debug(...) 71
#define LINE 71;
#endif

void print() { cout << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
};

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
};

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
};

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

  int a, b, c; cin >> a >> b >> c;
  cout << ((a*a + b*b < c*c) ? "Yes": "No") << endl;

  return 0;
};


#include<bits/stdc++.h>
using namespace std;
const double eps=1e-5;//精度
int n;
struct point{
	int x,y;
}p[110];
int fa[110];
int father(int x){
	return fa[x]==x?x:fa[x]=father(fa[x]);
}
double dis(int x,int y){
	return sqrt(pow(p[x].x-p[y].x,2)+pow(p[x].y-p[y].y,2));
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		cin>>p[i].x>>p[i].y;
	}
	double l=0,r=100,mid,ans=0;
	while(r-l>eps){
		mid=(l+r)/2;
		for(int i=1;i<=n+2;i++) fa[i]=i;
		for(int i=1;i<=n;i++){//枚举所有点进行合并
			for(int j=1;j<=n;j++)
				if(dis(i,j)<=mid*2)
				fa[father(j)]=father(i);//合并
			if(100-p[i].y<=mid*2)fa[father(n+1)]=father(i);//连接上下边界
			if(p[i].y+100<=mid*2)fa[father(n+2)]=father(i);
		}
			if(father(n+1)!=father(n+2)) ans=l=mid;//二者还没有接上,还可以大
			else r=mid;//二者已经接上了,考虑更小
	}
	printf("%.5f\n",ans);
	return 0;
}

# include <algorithm>
# include <stdio.h>
# include <math.h>

using namespace std;

int n, k;
int x[111];
int y[111];
int f[111];

struct edge {
  int x;
  int y;
  double l;
} e[10010];

bool cmp(edge a, edge b) {
  return a.l < b.l;
}

int fi(int x) {
  int t = x;
  while (t != f[t]) {
    t = f[t];
  }
  while (x != f[x]) {
    int T = f[x];
    f[x] = t;
    x = T;
  }
  return t;
}

void ji(int x, int y) {
  f[fi(x)] = fi(y);
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", x + i, y + i);
    for (int j = 1; j < i; j++) {
      e[++k].x = i;
      e[k].y = j;
      e[k].l = sqrt((x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]));
    }
  }
  for (int i = 1; i <= n; i++) {
    e[++k].x = 0;
    e[k].y = i;
    e[k].l = 100 - y[i];
    e[++k].x = n + 1;
    e[k].y = i;
    e[k].l = y[i] + 100;
  }
  e[++k].x = 0;
  e[k].y = n + 1;
  e[k].l = 200;
  sort(e + 1, e + 1 + k, cmp);
  for (int i = 0; i <= n + 1; i++) {
    f[i] = i;
  }
  for (int i = 1;; i++) {
    ji(e[i].x, e[i].y);
    if (fi(0) == fi(n + 1)) {
      printf("%.18f", e[i].l / 2);
      return 0;
    }
  }
}


#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    int n, m;
    std::cin >> n >> m;
    std::vector<int> a(m);
    for (int i=0; i<m; ++i) {
        std::cin >> a[i];
    }
    std::sort(a.begin(), a.end());
    std::vector<int> s;
    for (int i=0; i<=m; ++i) {
        int j;
        if (i == m) {
            j = n+1;
        } else {
            j = a[i];
        }
        int k;
        if (i == 0) {
            k = 0;
        } else {
            k = a[i-1];
        }
        if (j-k-1 > 0) s.push_back(j-k-1);
    }
    if (s.size() == 0) {
        std::cout << 0 << std::endl;
        return 0;
    }
    int min = *std::min_element(s.begin(), s.end());
    int ans = 0;
    for (auto i : s) {
        ans += i/min;
        ans += i%min != 0 ? 1 : 0;
    }
    std::cout << ans << std::endl;
}

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

const int N = 810;
int n, k, a[N][N];
bool check(int mid)
{
	int s[N][N], d[N][N];
	memset(s, 0, sizeof(s));
	memset(d, 0, sizeof(d));
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= n; j++)
		{
			s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + (a[i][j] < mid);
			d[i][j] = d[i - 1][j] + d[i][j - 1] - d[i - 1][j - 1] + (a[i][j] == mid);
		}
	}
	for(int i = 1; i <= n - k + 1; i++)
	{
		for(int j = 1; j <= n - k + 1; j++)
		{
			int x = i + k - 1, y = j + k - 1;
			int t = s[x][y] - s[i - 1][y] - s[x][j - 1] + s[i - 1][j - 1];
			int cnt = d[x][y] - d[i - 1][y] - d[x][j - 1] + d[i - 1][j - 1];
			if(t + cnt >= k * k / 2 + k % 2) return true;
		}
	}
	return false;
}
int main()
{
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= n; j++)
		{
			cin >> a[i][j];
		}
	}
	int l = 0, r = 1e9;
	while(l < r)
	{
		int mid = l + r >> 1;
		if(check(mid)) r = mid;
		else l = mid + 1;
	}
	cout << l << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main()
{
	ll t = 1;
//	cin >> t;
	while(t--)
	{
		ll n;
		cin >> n;
		ll c = 0 , x = 1 , c1 = 0;
		while(1)
		{
			// x*y + x*(x-1)/2 =
			ll val = n - ((x*(x-1))/2);
		//	cout << val << endl;
			ll val1 = val / x;
			if(val1 < 0)
				break;
			if(val % x == 0 && val1 > 0)
			{
			//	cout << "i " << val1 << endl;
				c++;
			}
			x++;
		}
		cout << 2*c+c1 << endl;
	}
}

#include<bits/stdc++.h>
#define pb push_back
 #define fo(i,n) for(int i=0;i<n;i++)
#define ll long long
#define int long long
#define Mod 1000000007
#define maxn 200005
#define MAX 4294967296  // 2^32
const int M=1e9+7;
#define ip pair<int,int>
#define test(t) ll t;cin>>t;while(t--)

using namespace std;

long long power(int x,int y){
if(y==0)return 1;

long long res=1;
while(y>0){
    if(y&1){
        res=(res*x)%Mod;

    }
    x=x*x%Mod;
  y/=2;
}
return res;

}

ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
long long gcd(int x,int y){
    // if(y>x)swap(x,y);
    if(y==0)return x;
    return gcd(y,x%y);
}
// const int N=200005;
// int dp[N];
// int r=1000000000000000005;
int fact[250005];
// int prime[25]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
// set<int>st;
int mul(int l,int r){
    return ((l%Mod)%Mod*(r%Mod)%Mod)%Mod;
}
int nCr(int n,int k){
if(n<k)return 0;
int ans=fact[n]%Mod;
ans=mul(ans,power(fact[n-k],Mod-2));
ans=mul(ans,power(fact[k],Mod-2));
return ans;
}

// int n;
// int v=100000000000000;
// void dfs(int i,int j){
// size[i]=1;
// bool is=1;
// for(auto it:adj[i]){
//     if(!vis[it]){
//         dfs(it,i);
//         size[i]+=size[it];

//     }
// }

// }
bool prime(int x){

if(x<2)return false;

for(int i=2;i*i<=x;i++){
    if(x%i==0)return false;

}
return true;

}

void solve(){

int n;
cin>>n;
int ans=0;
for(int i=2;i<=(i*(i+1))/2;i++){
    if((n-((i*(i+1))/2))%i==0)ans++;
}

cout<<2*ans;
return ;

}

signed main(){

    // std::string binary = std::bitset<8>(n).to_string();
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   // memset(fact,0,sizeof(fact));

 // test(t)

int n;
cin>>n;
int ans=1;
for(int i=2;(i*(i+1))/2<=n;i++){
    if((n-((i*(i+1))/2))%i==0)ans++;
}

cout<<2*ans;

}


#include<bits/stdc++.h>
using namespace std;
long long a,s,x,mx;
int n;
int main(){
	cin>>n;
	int i;
	for(i=1;i<=n;i++){
		cin>>x;
		mx=max(mx,x);
		a+=x;
		s+=a;
		cout<<s+i*mx<<endl;
	}
}

#include <bits/stdc++.h>
#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;
typedef vector<vi> vvi;

typedef set<int> si;

#define vt vector
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define ts to_string
#define EACH(x, a) for (auto& x: a)

template<class T> void read(T &x){ cin >> x; }
template<class A> void read(vt<A> &v){ EACH(x, v) read(x); }
template<class H, class... T> void read(H& h, T& ...t){ read(h); read(t...); }

str to_string(const char* c){ return (str)c; }
str to_string(char c){ return (str)""+c; }
str to_string(str s){ return s; }
str to_string(bool b){ return b?"True" : "False"; }
template<class A> str to_string(vt<A> v){ str s; EACH(x, v) s+= to_string(x) + " "; return s; }
template<class H, class... T> str to_string(H& h, T& ...t){ str s; s+=to_string(h); s+=" "; s+=to_string(t...); return s; }
void print(str s){ cout << s << "\n"; }
template<class... A> void print(A ...a){ print(to_string(a...)); }

int cdiv(int a, int b) { return a/b+!(a<0||a%b == 0); }
str tb(int x) {str ans; int c = x; for(int i = log2(x); i >= 0; --i){if(pow(2,i) <= c){ ans += "1"; c-=pow(2,i); } else { ans += "0"; } } return ans;}
bool ispr(int x){if(x <= 1){return false;} for(int i = 2; i <= sqrt(x); ++i){ if(x%i == 0){ return false; } }return true; }

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;

//tree<int,null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> T;

void solve(){
	ll n; cin >> n;
	vl v(n); read(v);
	ll ans = 0;
	ll mx = 0;
	ll su = 0;
	for(int i = 0; i < n; ++i){
		su+=v[i];
		ans+=su;
		mx=max(mx,v[i]);
		cout << mx*(i+1)+ans << '\n';
	}

}

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

	bool isT = 0;
	if(isT){
		int t; cin >> t; while(t--){
			solve();
		}
		return 0;
	}
	solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep0(i, n) for (ll i = 0; i <= (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep1(i, n) for (ll i = (n); i > 0; --i)
#define rrep0(i, n) for (ll i = (n); i >= 0; --i)
#define srep(i, s, t) for (ll i = s; i < t; ++i)
#define srep1(i, s, t) for (ll i = s; i <= t; ++i)
#define rsrep1(i, s, t) for (ll i = s; i >= t; --i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define snuke srand((unsigned)clock() + (unsigned)time(NULL));
#define show(x) cerr << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
typedef vector<string> vs;
template <typename T>
istream &operator>>(istream &i, v(T) & v)
{
    rep(j, sz(v)) i >> v[j];
    return i;
}
#define dame        \
    {               \
        puts("-1"); \
        return 0;   \
    }
#define yn           \
    {                \
        puts("Yes"); \
    }                \
    else { puts("No"); }
constexpr ll MAX = 2000001;
constexpr ll LINF = 9223372036854775807;
constexpr ll mod = 1000000007;
//constexpr ll mod = 998244353;

int main()
{
    ll n;
    cin >> n;
    rep(i, n)
    {
        string s;
        cin >> s;
        if ("atcoder" < s)
        {
            cout << 0 << endl;
            continue;
        }
        string t = s;
        sort(t.begin(), t.end());
        reverse(t.begin(), t.end());
        if ("atcoder" > t)
        {
            cout << -1 << endl;
            continue;
        }
        rep(i, s.size())
        {
            if (s.at(i) != 'a')
            {
                if (s.at(i) > 't')
                    cout << i - 1 << endl;
                else
                    cout << i << endl;
                break;
            }
        }
    }
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

void solve()
{
    string s;
    cin>>s;
    int n=s.size();
    s="."+s;
    string t=".atcoder";
    int res=-1;
    for(int i=0;i<=7;i++)
    {
        string a=s;
        int cur=0;
        for(int j=1;j<=i;j++)
        {
            bool found=false;
            for(int k=j;k<=n;k++)
            {
                if(a[k]==t[j])
                {
                    found=true;
                    for(int z=k;z>j;z--)
                    {
                        cur++;
                        swap(a[z],a[z-1]);
                    }
                    break;
                }
            }
            if(!found) cur=1e9;
            //if(i==7) cout<<j<<' '<<found<<' ';
        }
        bool have=false;
        if(i!=7)
        {
            for(int k=i+1;k<=n;k++)
        {
            if(a[k]>t[i+1])
            {
                have=true;
                for(int z=k;z>i+1;z--)
                {
                    cur++;
                    swap(a[z],a[z-1]);
                }
                break;
            }
        }
        }
        if(cur==1e9) continue;
        if(have||(i==7&&n>7))
        {
            if(res==-1||res>cur) res=cur;
        }
    }
    cout<<res<<'\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin>>t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
// #include <atcoder/all>
// using namespace atcoder;

int main(){
    int n, w;
    cin >> n >> w;
    int ans = n/w;
    cout << ans << endl;
}

#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<iomanip>
#include<regex>
using namespace std;
#define int long long
const int mod=1e9+7;
bool pri[1000001],squf[1000001],even[1000001];
signed main(){
	int l,r;
	cin>>l>>r;
	for(int i=2;i<=r;i++)
		pri[i]=squf[i]=even[i]=1;
	for(int i=2;i<=r;i++){
		if(!pri[i])
			continue;
		for(int j=i;j<=r;j+=i){
			if(j!=i)
				pri[j]=0;
			even[j]=!even[j];
		}
		for(int j=i*i;j<=r;j+=i*i)
			squf[j]=0;
	}
	int ans1=0,ans2=0;
	for(int g=2;g<=r;g++){
		if(!squf[g])
			continue;
		int a=r/g-(l-1)/g;
		a=a*(a-1)/2;
		if(even[g])
			ans1-=a;
		else
			ans1+=a;
	}
	for(int g=max(2ll,l);g<=r;g++)
		ans2+=r/g-1;
	cout<<(ans1-ans2)*2<<endl;
}


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

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(c) (c).begin(),(c).end()
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long double ld;
typedef pair<ll,ll> pii;

const ll inf = 1e9;
const ll inf64 = 1e18;
const ll MOD = inf + 7;

void solve()
{
	ll n,k;
	cin>>n>>k;
	string s=std::to_string(n);
	ll last=n;
	for(ll i=1;i<=k;i++)
	{
		//cout<<last<<"\n";
		string s1=std::to_string(last);
		sort(s1.begin(),s1.end());
		string s2=s1;
		sort(s2.rbegin(),s2.rend());
		ll g=stoi(s2);
		ll r=stoi(s1);
		last=g-r;
	}
	cout<<last;
}

int main()
{
   fast;
   ll t=1;
   //cin>>t;
   while (t--)  solve();
}

#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    const auto g1 = [](long a) {
        std::vector<long> v;
        while (a > 0) {
            v.push_back(a % 10);
            a /= 10;
        }

        std::sort(v.begin(), v.end(), std::greater<long>());

        long ret = 0;
        long n = 1;
        for (auto it = v.rbegin(); it != v.rend(); ++it, n *= 10) {
            ret += *it * n;
        }

        return ret;
    };

    const auto g2 = [](long a) {
        std::vector<long> v;
        while (a > 0) {
            v.push_back(a % 10);
            a /= 10;
        }

        std::sort(v.begin(), v.end());

        long ret = 0;
        long n = 1;
        for (auto it = v.rbegin(); it != v.rend(); ++it, n *= 10) {
            ret += *it * n;
        }

        return ret;
    };

    const auto f = [&g1, &g2](long a) { return g1(a) - g2(a); };

    long n, k;
    std::cin >> n >> k;

    long ret = n;
    for (long i = 0; i < k; ++i) {
        ret = f(ret);
    }

    std::cout << ret << std::endl;
    return 0;
}


#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ub              upper_bound
#define lb              lower_bound
#define isrt            insert
#define clr             clear
#define rsz             resize
#define ff              first
#define ss              second
#define lli             long long int
#define pb              push_back
#define pf              push_front
#define mkp              make_pair
#define pii             pair<lli,lli>
#define vi              vector<int>
#define mii             map<lli,lli>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define INF             1e9
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define endl            "\n"
const double PI = acos(-1);

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

lli maxm(lli a, lli b)
{
  return (a >= b ? a : b);
}

lli minm(lli a, lli b)
{
  return (a <= b ? a : b);
}

lli power(lli x, lli y, lli p)
{
  lli res = 1;

  x = x % p;
  if (x == 0)
    return 0;

  while (y > 0)
  {

    if (y & 1)
      res = (res * x) % p;

    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}

lli nCrmodp(lli n, lli r, lli p)
{
  if (r == 0)
    return 1;
  if (r == 1)
    return n;

  lli pro = 1, k = n;
  while (k > r)
  {
    pro *= k;
    pro %= p;
    --k;
  }

  k = 2;
  while (k <= (n - r))
  {
    pro *= power(k, (p - 2), p);
    pro %= p;
    ++k;
  }

  return pro;
}

lli first_big(lli n, lli k, vector<lli> arr)
{
  lli l, r, ans = n;
  l = 0;
  r = n - 1;

  while (l <= r) {
    lli m = l + (r - l) / 2;

    if (arr[m] > k) {
      ans = m;
      r = m - 1;
    }

    else
      l = m + 1;
  }

  return ans;
}

lli last_small(lli n, lli k, vector<lli> arr)
{
  lli l, r, ans = -1;
  l = 0;
  r = n - 1;

  while (l <= r)
  {
    lli mid = (l + r) / 2;

    if (arr[mid] <= k)
    {
      ans = mid;
      l = mid + 1;
    }
    else
      r = mid - 1;
  }

  return ans;
}

void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

int main()
{
  c_p_c();

  int n;
  cin >> n;
  vector<int>v(n);

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

  int ans = v[0];
  for (int i = 1; i < n; ++i)
    ans = __gcd(ans, v[i]);

  cout << ans << endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
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;cin>>n;
	ll x;cin>>x;
	for(int i = 1; i < n; i++) {
		ll y;cin>>y;
		x = __gcd(x,y);
	}
	cout << x << endl;
	return 0;
}


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

const int N=4e5+1e3+7;

int C(int n,int m)
{
	if(n<m||n<0||m<0)
		return 0;
	long long ret=1;
	for(int i=n;i>=n-m+1;i--)
		ret=ret*i;
	for(int i=1;i<=m;i++)
		ret=ret/i;
	return ret%3;
}

int Lucas(int n,int m)
{
	if(n<3||m<3)
		return C(n,m);
	return C(n%3,m%3)*Lucas(n/3,m/3)%3;
}

int get(char c)
{
	return c=='R'?0:c=='B'?1:2;
}

int n;

char s[N];

string ans="RBW";

int main()
{
	scanf("%d",&n);
	scanf("%s",s);
	n--;
	int r=0;
	for(int i=0;i<=n;i++)
		(r+=Lucas(n,i)*get(s[i]))%=3;
	if(n&1)
		r=(3-r)%3;
	putchar(ans[r]);
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(x,y,z) for(int x=y;x<=z;x++)
const int N=4e5+10;
const double eps = 0.01;
const ll mod = 1e9+7;
const double pi = acos(-1.0) ;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll DIV=100000;
inline ll read()
{
    ll x=0,f=1;char ch=getchar();
    while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
    while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
inline void pt(ll ans,ll f){
    printf("%lld",ans);
    if(f==1) putchar(' ');
    else putchar('\n');
}
ll n,m,k,tot;
ll f[N],g[N];
string str;
int main() {
//    scanf("%d%d", &n, &m);
    int q;
    f[1]=0,g[1]=g[0]=1;
    for(int i=2;i<N;i++){
        int cnt=0,tmp=i;
        while(tmp%3==0){
            tmp/=3;
            cnt++;
        }
        f[i]=f[i-1]+cnt;
        g[i]=g[i-1]*tmp%3;
    }
    n = read();
    cin>>str;
    int len=str.length();
    ll ans=0;
    for(int i=0;i<len;i++){
//        cout<<f[i]<<":"<<g[i]<<endl;
        if(str[i]=='W') ans=ans+(f[n-1]-f[i]-f[n-1-i]==0)*g[n-1]*g[i]*g[n-1-i]%3;
        else if(str[i]=='R') ans=ans+2*(f[n-1]-f[i]-f[n-1-i]==0)*g[n-1]*g[i]*g[n-1-i]%3;
//        pt(ans,2);
        ans%=3;
    }
//    cout<<ans<<endl;
    if(n%2==0) ans=(-ans+3)%3;
    if(ans==0) putchar('B');
    else if (ans == 1 ) putchar('W');
    else putchar('R');
    return 0;
}


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

int main(){
  int a,b;cin>>a>>b;
  vector<ll> x(a,0),y(b,0);
  ll ttl=0;
  REP(i,a){
    x.at(i)=600000-i;
    ttl+=x.at(i);
  }
  ll ttl2=0;
  REP(i,b-1){
    y.at(i)=i+1;
    ttl2+=y.at(i);
  }
  y.at(b-1)=ttl-ttl2;
  REP(i,a) cout<<x.at(i)<<" ";
  REP(i,b) cout<<-y.at(i)<<" ";
  cout<<endl;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
using ll = long long;
int mod = 1000000007;
const int INF = 1001001001;
template<class T> void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> void chmax(T& a, T b) {if (a < b) a = b;}
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
using Graph = vector<vector<int>>;

int main() {
    int a, b; cin >> a >> b;
    if (a == b) {
        for (int i = 1; i <= a; i++) {
            cout << i << " " << -i << " ";
        }
        cout << endl;
        return 0;
    }
    int mi = min(a, b);
    int mx = max(a, b);
    int p = mx * (mx + 1) / 2;
    int d = (mi - 1) * mi / 2;
    for (int i = 1; i < mi; i++) {
        cout << i << " " << -i << " ";
    }
    int x = p - d;
    if (a > b) {
        for (int i = mi; i < mx + 1; i++) {
            cout << i << " ";
        }
        cout << -x << endl;
        return 0;
    }
    else {
        for (int i = mi; i < mx + 1; i++) {
            cout << -i << " ";
        }
        cout << x << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int n;
ll a[100100],b[100100];
ll sum=0;
int main()
{
	ios::sync_with_stdio(0);
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	rep(i,n)sum+=a[i]*b[i];
	if(sum==0)cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int n;
int a[100000], b[100000];
int result;

int main() {
    cin >> n;
    for(int i=0; i<n; i++)
        cin >> a[i];
    for(int i=0; i<n; i++)
        cin >> b[i];

    for(int i=0; i<n; i++)
        result += a[i] * b[i];

    cout << (result == 0 ? "Yes" : "No");
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    ll n;
    cin >> n;
    ll a;
    cin >> a;
    ll b;
    cin >> b;

    cout << n-a+b << '\n';

    return 0;
}

//******\\
||udc321||
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<queue>
#include<map>
#include<set>
#include<fstream>
#include<cstring>
#include<sstream>
#define ll long long
#define fr(e,r,v) for(ll e=r;e<v;e++)
#define bc(e,r,v) for(ll e=r;e>v;e--)
#define all(n) (n.begin(),n.end())
#define tr(ctn,it) for(typeof(ctn.begin()) it=ctn.begin(); it!=ctn.end();it++)
#define ft first
#define sd second
#define pb push_back
#define lb lower_bound
#define mpr make_pair
#define db  double
using namespace std;
ll mod=1000000007;
/*mt19937 rng(chrono::steady_clock::now().
time_since_epoch().count());*/

int main()
{
ll n,a,b;
cin>>n>>a>>b;
cout<<n-a+b<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> pin;

const int N = 2005;
const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};

int n, m, f[N][N];
char s[N][N];
bool vis[N][N];
vector <pin> vec[26];

template <typename T>
inline void read(T &X) {
    char ch = 0; T op = 1;
    for (X = 0; ch > '9' || ch < '0'; ch = getchar())
        if (ch == '-') op = -1;
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        X = (X * 10) + ch - '0';
    X *= op;
}

inline bool valid(int x, int y) {
    return x >= 1 && x <= n && y >= 1 && y <= m && s[x][y] != '#';
}

queue <pin> q;
inline int solve(int sx, int sy, int ex, int ey) {
    q.push(pin(sx, sy));
    vis[sx][sy] = 1;
    for (; !q.empty(); ) {
        pin now = q.front(); q.pop();
        int x = now.first, y = now.second;
        if (x == ex && y == ey) return f[x][y];
        for (int i = 0; i < 4; i++) {
            int tox = x + dx[i], toy = y + dy[i];
            if (valid(tox, toy) && !vis[tox][toy]) {
                f[tox][toy] = f[x][y] + 1;
                vis[tox][toy] = 1;
                q.push(pin(tox, toy));
            }
        }
        if (s[x][y] >= 'a' && s[x][y] <= 'z') {
            int c = s[x][y] - 'a';
            for (int i = 0; i < vec[c].size(); i++) {
                int tox = vec[c][i].first, toy = vec[c][i].second;
                if (vis[tox][toy]) continue;
                vis[tox][toy] = 1;
                f[tox][toy] = f[x][y] + 1;
                q.push(pin(tox, toy));
            }
        }
    }
    return -1;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("sample.in", "r", stdin);
#endif

    read(n), read(m);
    for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
    int sx, sy, ex, ey;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++) {
            if (s[i][j] == 'G') ex = i, ey = j;
            if (s[i][j] == 'S') sx = i, sy = j;
            if (s[i][j] >= 'a' && s[i][j] <= 'z') vec[s[i][j] - 'a'].push_back(pin(i, j));
        }
    printf("%d\n", solve(sx, sy, ex, ey));
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define drep(i,b,a) for(int i = (b)-1; i >= (a); i--)
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(v) sort(v.begin(),v.end());
#define RSORT(v) sort(v.rbegin(),v.rend());
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vd> vvd;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
const int inf = 1 << 30; const ll infl = 1LL << 60; const double PI = acos(-1.0);
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; }
template<class T> inline bool  odd(T x) { return x & 1; }
template<class T> inline bool even(T x) { return !(x & 1); }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill( (T*)array, (T*)(array+N), val );
}
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << endl; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s; }
//----------------------------------------------------------------------------------------------

using P = pair<int,int>;
int dist[2020][2020];
const int di[] = {1, 0,-1, 0};
const int dj[] = {0, 1, 0,-1};

int main()
{
    int h,w;
    cin >> h >> w;
    vector<string> g(h);
    rep(i,0,h) cin >> g[i];

    vector<vector<P>> table(26);
    vector<bool> used(26);
    int si,sj,gi,gj;
    rep(i,0,h) rep(j,0,w) {
        char c = g[i][j];
        if('a' <= c && c <= 'z') table[c-'a'].emplace_back(i,j);
        if(c == 'S') si = i, sj = j;
        if(c == 'G') gi = i, gj = j;
    }

    Fill(dist, -1);
    queue<P> que;
    dist[si][sj] = 0;
    que.emplace(si,sj);
    while(!que.empty()) {
        auto [ci,cj] = que.front(); que.pop();
        rep(k,0,4) {
            int ni = ci + di[k];
            int nj = cj + dj[k];
            if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
            if(g[ni][nj] == '#' || dist[ni][nj] != -1) continue;
            dist[ni][nj] = dist[ci][cj] + 1;
            que.emplace(ni,nj);
        }
        char c = g[ci][cj];
        if('a' <= c && c <= 'z') {
            if(used[c-'a']) continue;
            for(auto [ni,nj] : table[c-'a']) {
                if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
                if(g[ni][nj] == '#' || dist[ni][nj] != -1) continue;
                dist[ni][nj] = dist[ci][cj] + 1;
                que.emplace(ni,nj);
            }
            used[c-'a'] = true;
        }
    }
    cout << dist[gi][gj] << endl;
    return 0;
}


// #pragma optimization_level 3
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define  MOD             1000000007
#define  sym(s)          s = "#" + s + "#";
#define  INF             1e18
#define  newl            cout<<"\n";
#define  pb              push_back
#define  ppb             pop_back
#define  mp              make_pair
#define  ff              first
#define  ss              second
#define  PI              3.141592653589793238462
#define  set_bits        __builtin_popcountll
#define  sz(x)           ((int)(x).size())
#define  all(x)          (x).begin(), (x).end()
#define  alll(x,n)       x+1, x+n+1
#define  foo(i,a,n)      for(ll i = (a); i <= n; i++)
#define  deb1(a)         cout<<a<<"\n";
#define  deb2(a,b)       cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)     cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)   cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  debp(a)         cout<<a.ff<<" "<<a.ss<<"\n";
#define  debv(a)         for(auto it: a)cout<<it<<" ";newl;
#define  debm(a)         for(auto it: a)cout<<"{"<<it.ff<<","<<it.ss<<"}, ";newl;
#define  deb1d(a,n)      foo(i,1,n)cout<<a[i]<<" ";newl;
#define  deb2d(a,n,m)    foo(i,1,n){foo(j,1,m){cout<<a[i][j]<<" ";}newl;}
const int  N          =  (int)2e+5 + 8;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;
// typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update > pbds; // find_by_order, order_of_key

#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif

void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(ld t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}

template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
vll v;
ll t;
bool P(ll x){
	int k=upper_bound(all(v),x)-v.begin();
	return (x-k+1)>=t;
}

ll bsmin(ll L, ll R){
    ll mid;
    while (L < R) {
        mid = L + (R - L) / 2;
        if (P(mid)) R = mid;
        else L = mid + 1;
    }
    if (!P(L)) return -1;
    return L;
}
void MAIN(ll tc) {
    #ifndef ONLINE_JUDGE
    freopen("Error.txt", "w", stderr);
    #endif
    ll n,q; cin>>n>>q;
    v.resize(n);
    for(ll &x:v)cin>>x;
    v.pb(0);
    sort(all(v));
    for(int i=0;i<q;i++){
    	cin>>t;
    	cout<<bsmin(1,LLONG_MAX)<<"\n";
    }
}
int main(){
    fastio();
    cout<<fixed; cout<<setprecision(10);

    int test__cases = 1;
    // cin>>test__cases;
    for(int i = 1; i <= test__cases; i++){
        MAIN(i);
    }
}

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define forn(i,x1,n)     for(int i=x1; i<n; i++)
#define forit(it, m)    for(decltype(m)::iterator it = m.begin(); it!=m.end(); ++it)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x1)      __builtin_popcountll(x1)
#define zrobits(x1)      __builtin_ctzll(x1)
#define mod             1000000007
// #define mod             998244353
#define inf             1e18
#define ps(x1,y)         fixed<<setprecision(y)<<x1
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x1)            int x1; cin>>x1; while(x1--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

void zeus()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main() {

	zeus();

	int n, q; cin >> n >> q;

	int a[n + 1];

	forn(i, 0, n) {
		cin >> a[i];
	}
	a[n] = 0;

	sort(a, a + n + 1);
	int diff[n];

	forn(i, 0, n) {
		diff[i] = a[i + 1] - a[i] - 1;
	}
	int prefixsum[n + 1];
	prefixsum[0] = 0;

	forn(i, 0, n) {
		prefixsum[i + 1] = prefixsum[i] + diff[i];
	}

	forn(i, 0, q) {
		int k; cin >> k;
		auto ind = lower_bound(prefixsum, prefixsum + n + 1, k) - prefixsum;
		cout << a[ind - 1] + k - prefixsum[ind - 1] << endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<ll,ll>
#define pd pair<ld,ld>
#define pb push_back
#define inf 1e16
#define en '\n'
#define ld long double
#define ff first
#define ss second
#define ull unsigned long long
#define lb lower_bound
#define ub upper_bound
#define fr(a,b,c) for(ll a = b ; a <= c ; ++a )
#define frn(a,b,c) for(ll a = b ; a >= c ; a -- )
#define fra(a,b) for(auto a: b)
#define ms(a) memset(a,0,sizeof a);
#define alla(a) a,a+n
#define allv(a) a.begin(),a.end()
#define size(a) (ll)a.size()
#define getMat(x,n,m,val) vector<vector<ll>>x(n,vector<ll>(m,val))
const ll MAXN = 1e5+5;
#define pii 3.14159265358979323846
const ll mod = 998244353;
ll pw(ll b, ll r, ll md=mod){
	b = b%mod;
	r = r%mod;
	ll ans = 1;
	while(r){
		if(r&1)ans = (ans*b)%md;
		b = (b*b)%md;
		r>>=1;
	}
	return ans;
}
ll dp[3010][6010];
ll rec(ll n, ll k){
	if(k>n)return 0;
	if(n==0 && k==0)return 1LL;
	else if(n==0 || k==0)return 0LL;
	if(dp[n][k]!=-1)return dp[n][k];
	dp[n][k]=(rec(n-1,k-1)+rec(n,2*k))%mod;
	return dp[n][k];
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll t=1;
	// cin>>t;
	while(t--){
		ll n,k;cin>>n>>k;
		fr(i,0,n)fr(j,0,2*n)dp[i][j]=-1;
		cout<<rec(n,k)<<en;
	}
	return 0 ;
}

#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC optimize(3 , "Ofast" , "inline")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <stack>
#include <set>
#include <bitset>
#include <deque>
using namespace std ;
#define ios ios::sync_with_stdio(false) , cin.tie(0)
#define x first
#define y second
#define pb push_back
#define ls rt << 1
#define rs rt << 1 | 1
typedef long long ll ;
const double esp = 1e-6 , pi = acos(-1) ;
typedef pair<int , int> PII ;
const int N = 1e6 + 10 , INF = 0x3f3f3f3f , mod = 1e9 + 7;
ll qmi(ll a , ll b) {
    ll res = 1 ;
    while(b) {
        if(b & 1) res = res * a % mod ;
        a = a * a % mod ;
        b >>= 1 ;
    }
    return res ;
}
int work()
{
  int n , p ;
  cin >> n >> p ;
  ll ans = 1ll * (p - 1) * qmi(p - 2 , n - 1) % mod ;
  cout << ans << "\n" ;
  return 0 ;
}
int main()
{
  //   freopen("C://Users//spnooyseed//Desktop//in.txt" , "r" , stdin) ;
  //   freopen("C://Users//spnooyseed//Desktop//out.txt" , "w" , stdout) ;

  work() ;
  return 0 ;
}
/*

*/


#include <bits/stdc++.h>
#define rep(a,b,c) for(ll a = b; a < c; a++)
#define rep2(a,b,c) for(ll a = c - 1; a >=b; a--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define x first
#define y second
using namespace std;
using ll = long long;
using tl = tuple<ll, ll, ll>;
using pl = pair<ll, ll>;
using pi = pair<int, int>;
using ld = long double;

const int MAX = 2e5 + 3;
string S;
map<char, int> m;
ll ans;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	cin >> S;
	rep2(i, 2, S.size()) {
		m[S[i]]++;
		if (S[i - 2] == S[i - 1] && S[i - 1] != S[i]) {
			ans += S.size() - i - m[S[i - 2]];
			m.clear();
			m[S[i - 2]] = S.size() - i;
		}
	}
	cout << ans;
	return 0;
}

#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define int long long
#define st first
#define nd second
#define rd third
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define RE(i, n) FOR(i, 1, n)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define __builtin_ctz __builtin_ctzll
#define __builtin_clz __builtin_clzll
#define __builtin_popcount __builtin_popcountll
using namespace std;
template<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) {
  while(*sdbg != ',') { cerr<<*sdbg++; } cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
#define next ____next
#define prev ____prev
#define left ____left
#define hash ____hash
typedef long long ll;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<pair<int, int> > VPII;
typedef vector<pair<ll, ll> > VPLL;

template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
template<class T1, class T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class A, class B, class C> struct Triple { A first; B second; C third;
  bool operator<(const Triple& t) const { if (st != t.st) return st < t.st; if (nd != t.nd) return nd < t.nd; return rd < t.rd; } };
template<class T> void ResizeVec(T&, vector<int>) {}
template<class T> void ResizeVec(vector<T>& vec, vector<int> sz) {
  vec.resize(sz[0]); sz.erase(sz.begin()); if (sz.empty()) { return; }
  for (T& v : vec) { ResizeVec(v, sz); }
}
typedef Triple<int, int, int> TIII;
template<class A, class B, class C>
ostream& operator<< (ostream &out, Triple<A, B, C> t) { return out << "(" << t.st << ", " << t.nd << ", " << t.rd << ")"; }
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class L, class R> ostream& operator<<(ostream& out, map<L, R> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }

const int N = 111;
typedef bitset<N> B;

int32_t main() {

  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cerr << fixed << setprecision(10);
  cin.tie(0);
  //double beg_clock = 1.0 * clock() / CLOCKS_PER_SEC;

  int n;
  cin>>n;
  vector<B> dis(n + 2);
  RE (i, n) {
    string s;
    cin>>s;
    dis[i][i] = 1;
    RE (j, n) {
      if (s[j - 1] == '1') {
        dis[j][i] = 1;
      }
    }
  }
  LD res = 0;
  RE (i, n) {
    VI vis(n + 2);
    int cnt = 0;
    function<void(int)> Dfs = [&](int v) {
      vis[v] = 1;
      cnt++;
      RE (j, n) {
        if (dis[v][j] == 1 && !vis[j]) {
          Dfs(j);
        }
      }
    };
    Dfs(i);
    res += 1. / cnt;
  }
//   RE (k, n) {
//     RE (i, n) {
//       RE (j, n) {
//         dis[i] |= dis[i][k] & dis[k][j];
//       }
//     }
//   }
//   LD res = 0;
//   RE (i, n) {
//     res += 1. / dis[i].count();
//   }
  cout<<res<<endl;

  return 0;
}


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

#define  quick  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define s(x) sort(x.begin(),x.end())
#define sr(x) sort(x.begin(),x.end(),greater<ll>())
#define v1 vector<ll>
#define s1 set<ll>
#define p1 pair<ll,ll>
#define m1 map<ll,ll>
#define take(v,n) for(i=0;i<n;i++)    cin>>v[i];
#define print(v,n) for(i=0;i<n;i++)    cout<<v[i]<<" ";
#define ff first
#define ss second
#define ee '\n';
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define f(i,x,y) for(i=x;i<y;i++)
#define mp make_pair
#define yes cout<<"Yes"<<endl
#define no  cout<<"No"<<endl

bool sortbysec(const pair<string,ll> & a, const pair<string,ll> & b)
{
    return (a.second < b.second);
}

void solve()
{
        ll n,i;
        cin>>n;
        vector<pair<string,ll>> p;
        f(i,0,n)
        {
                  ll y;
                  string s;
                  cin>>s>>y ;
                  p.pb(mp(s,y));
        }
        sort(all(p), sortbysec);
        cout<<p[p.size()-2].ff<<ee;
}

 int32_t main()
 {
    quick;
    ll t=1;
    //cin>>t;
    while(t--)
    {
       solve();
    }
    return 0;
 }

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
using ld = double;

#define	sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define ins insert
#define nl "\n"

const ll MOD = 998244353;

ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}

template<typename T> T signum(T a) {
    return (a > 0) - (a < 0);
}

template<typename T> T cmp(T a, T b) {
    return signum(a-b);
}

template<typename T> bool mins(T& lhs , T& rhs) {
    if (rhs < lhs) {
        lhs = rhs;
        return true;
    }

    return false;
}

template<typename T> bool maxs(T& lhs , T& rhs) {
    if (rhs > lhs) {
        lhs = rhs;
        return true;
    }

    return false;
}

const int MAX = INT_MAX;

void gks(int tc) {
    printf("Case #%d: ", tc);
};

int main() {
    int n;
    cin>>n;
    vector<pair<int, string>>  a(n);
    for (int i = 0;i < n;++i) {
        cin>>a[i].second>>a[i].first;
    }

    auto cmp = [&] (const pair<int, string>& lhs, const pair<int, string>& rhs) {
        return lhs.first > rhs.first;
    };

    sort(all(a), cmp);
    cout<<a[1].second<<nl;

   return 0;
}


/*************************************************************************
	> File Name: 2.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com
	> Blog: https://blog.csdn.net/Pig_cfbsl
	> Created Time: 2020/10/24 20:09:51
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
const int maxx=4e5+10;
LL a[maxx],b[maxx];
LL n,m,u,v,be[maxx],ne[maxx],to[maxx],e=0,sum;
bool vis[maxx];
void add(int x,int y){
	to[++e]=y;
	ne[e]=be[x];
	be[x]=e;
}
void dfs(int x){
	vis[x]=1;
	sum+=b[x];
	for(int i=be[x];i;i=ne[i]){
		int go=to[i];
		if(!vis[go])
			dfs(go);
	}
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	n=read(); m=read();
	For(i,1,n) a[i]=read();
	For(i,1,n) b[i]=read()-a[i];
	For(i,1,m){
		u=read(); v=read();
		add(u,v); add(v,u);
	}
	For(i,1,n)
		if(!vis[i]){
			sum=0;
			dfs(i);
			if(sum!=0){
				printf("No\n");
				return 0;
			}
		}
	printf("Yes\n");
	return 0;
}

#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

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

// varibable settings
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T, class U> inline void chmax(T &a, const U &b) { if ((a) < (b)) (a) = (b); }
template <class T, class U> inline void chmin(T &a, const U &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

template <class T> T cdiv(T a, T b){ assert(a >= 0 && b > 0); return (a+b-1)/b; }

#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

int solve() {
    string s;cin>>s;
    int n = sz(s);
    int k = n;
    int sum = 0;
    vec<int> cnt(3);
    rep(i, n){
        int v = s[i] - '0';
        cnt[v%3]++;
        sum += v;
    }
    if (sum % 3 == 0){
        cout << 0 << endl;
        return 0;
    }
    else if (sum % 3 == 1){
        if (cnt[1] >= 1 && k>1) {
            cout << 1 << endl;
            return 0;
        }
        if (cnt[2] >= 2 && k>2) {
            cout << 2 << endl;
            return 0;
        }
        cout << -1 << endl;
        return 0;
    }
    else if (sum % 3 == 2){
        if (cnt[2] >= 1 && k>1) {
            cout << 1 << endl;
            return 0;
        }
        if (cnt[1] >= 2 && k>2) {
            cout << 2 << endl;
            return 0;
        }
        cout << -1 << endl;
        return 0;
    }

    return 0;
}

int main(){/*{{{*/
    solve();

    #if defined(PCM) || defined(LOCAL)
    check_input();
    #endif

    return 0;
}/*}}}*/


#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>

using namespace std;

signed main(){
    ios::sync_with_stdio(false);
    string str;
    cin>>str;
    bool flag=true;
    for(int i=0;i<str.size();++i){
        if(i&1){
            if(str[i]<'A'||str[i]>'Z'){
                flag=false;
                break;
            }
        }
        else{
            if(str[i]<'a'||str[i]>'z'){
                flag=false;
                break;
            }
        }
    }
    if(flag) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

#include<iostream>
using namespace std;
typedef long long li;
#define yn(i) print((i)?"Yes":"No")
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int diff(string s){
  int n=s.size();
  rep(i,n){
    if((s[i]<'a')!=(i%2==1)) return 0;
  }
  return 1;
}

int main(){
  string s; cin >>s;
  yn(diff(s));
}


#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#define f(i,a,b) for(ll  i = a; i < (ll) b ; i++ )
#define af(i,a,b) for(ll i = a; i >= (ll) b ; i--)
#define rep(i,a,b,k) for(ll  i = a; i < (ll) b ; i+= k )
#define arep(i,a,b,k) for(ll i = a; i >= (ll) b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define sz(a) (ll) a.size()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller   ios::sync_with_stdio(false);cin.tie(0)

// policy-based

using namespace std;

typedef long long ll; // ll or ll
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;

const ll MAX = 3e5 + 20;
const ll mod = 1e9 + 7;
const ll inf = 2e18;

// C function for extended Euclidean Algorithm
ll gcdExtended(ll a, ll b, ll* x, ll* y){
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1; // To store results of recursive call
    ll gcd = gcdExtended(b % a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b / a) * x1;
    *y = x1;

    return gcd;
}
ll tc,x,y,p,q;

ll modInverse(ll a, ll m){

    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x % m + m) % m;
    return res;
}

int main(){
	fastio;
	cin >> tc;
	while(tc--){
		cin >> x >> y >> p >> q;
		ll ans = inf;
		f(i,0,y){
			f(j,0,q){
				ll m1 = 2*(x+y),m2 = p+q,r1 = x+i,r2 = p + j;
				ll g = __gcd(m1,m2);
				if(r1%g != r2%g) continue;
				ll pp = m1/g, qq = m2/g,rr = (r1-r2)/g;
				ll alfa = ( (rr%pp + pp)%pp * modInverse(qq,pp))%pp;
				ll aux = m2*alfa + r2;

				ans = min(ans,m2*alfa + r2);
			}
		}
		if(ans == inf) cout << "infinity\n";
		else
			cout << ans << endl;
	}
	return 0;
}

#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
#define inf 0x7fffffff
#define ll long long
//#define llu unsigned long long
#define int long long
//#define int __int128
//#define double long double
//#define double long long
#define re register int
//#define void inline void
#define eps 1e-8
//#define mod 1e9+7
#define ls(p) p<<1
#define rs(p) p<<1|1
#define pi acos(-1.0)
#define pb push_back
#define mk make_pair
#define P pair < int , int >
using namespace std;
const int mod=1e9+7;
const int M=1e8;
const int N=5e5+5;//??????.???? 4e8
int n;
struct node
{
	int ver,edge,next;
}e[N];
int tot,head[N];
int d[N],f[N];
int ret=1,ans;
void add(int x,int y,int z)
{
	e[++tot].ver=y;
	e[tot].edge=z;
	e[tot].next=head[x];
	head[x]=tot;
}
void addedge(int x,int y,int z)
{
	add(x,y,z);add(y,x,z);
}
void dfs(int x,int pre)
{
	for(re i=head[x];i;i=e[i].next)
	{
		int y=e[i].ver;
		int z=e[i].edge;
		if(y==pre)  continue;
		d[y]=d[x]^z;
		dfs(y,x);
	}
}
void solve()
{
	cin>>n;
	for(re i=1;i<n;i++)
	{
		int x,y,z;
		scanf("%lld%lld%lld",&x,&y,&z);
		addedge(x,y,z);
	}
	dfs(1,1);
	for(re i=0;i<=60;i++)
	{
		int cnt=0;
		for(re j=1;j<=n;j++)  if((d[j]>>i)&1)  cnt++;
		ans=(ans+(ret*cnt)%mod*(n-cnt))%mod;
		ret=(ret*2)%mod;
	}
	cout<<ans<<endl;
}
signed main()
{
    int T=1;
//    cin>>T;
    for(int index=1;index<=T;index++)
    {
        solve();
//        puts("");
    }
    return 0;
}
/*

5 10
-1 -5 -3 5 -1
1

*/


#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define drep(i,j,n) for(int i=0;i<(int)(n-1);i++)for(int j=i+1;j<(int)(n);j++)
#define trep(i,j,k,n) for(int i=0;i<(int)(n-2);i++)for(int j=i+1;j<(int)(n-1);j++)for(int k=j+1;k<(int)(n);k++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yes(ans) if(ans)printf("yes\n");else printf("no\n")
#define Yes(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YES(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector1d(type,name,...) vector<type>name(__VA_ARGS__)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define vector3d(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
const int MOD2=998244353;
const int INF=1<<30;
const ll INF2=(ll)1<<60;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T,class L>void scan(pair<T, L>& p){scan(p.first);scan(p.second);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T,class L>void print(const pair<T, L>& p){print(p.first);putchar(' ');print(p.second);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}
template<class T> void chmax(T &a,const T b){if(b>a)a=b;}
template<class T> void chmin(T &a,const T b){if(b<a)a=b;}

int main(){
    codefor{
        INT(n);
        string s,t,u;
        cin>>s>>t>>u;
        string s1(n,'1'),s2(n,'0');
        cout<<s1<<s2<<"1"<<endl;
    }
}

#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}
int t,n;
char s1[maxn],s2[maxn],s3[maxn];

int main()
{
	//freopen("t1.in","r",stdin);
	cin>>t;
	while(t--)
	{
		cin>>n;
		scanf("%s%s%s",s1,s2,s3);
		printf("1");
		rep(i,1,n) printf("0");
		rep(i,1,n) printf("1");
		puts("");
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

// 強さをY以上にしない
// 経験値を最大化する
// 経験値は最初0
// 強さは最初X
// 強さをA倍にして、経験値を1増やす
// 強さをB増やして、経験値を1増やす

void solve(long long X, long long Y, long long A, long long B){
    ll ans = 0;
    while(1){
        if(X > Y/A) break;
        if(A*X >= Y) break;
        if(A*X >= X+B) break;
        X *= A;
        ans++;
    }
    ans += (Y-1-X) / B;
    cout << ans << endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(X, Y, A, B);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n, a, b;
	cin >> n >> a >> b;
	cout << n-a+b;
}


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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusive
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long;
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>;

long long LLINF = 1e18;
int INF = 1e9+1e6;
#define MAXN (100006)
ll n, A[MAXN], ans, mod=1e9+7, p2[MAXN], dp[MAXN][2];
ll mult(ll x,ll y) {
	x %= mod, y %= mod;
	return x * y % mod;
}
int main() {
	FAST
	cin>>n;
	FOR(i,1,n) cin>>A[i];
	if(n==1) {
		cout<<A[1]<<'\n';
		return 0;
	} else if(n==2) {
		cout<<A[1] * 2 % mod<<'\n';
		return 0;
	}
	p2[0] = 1;
	FOR(i,1,MAXN-1) p2[i]=p2[i-1]*2%mod;

	dp[0][0] = 1;
	FOR(i,1,n) {
		dp[i][0] = dp[i-1][0] + dp[i-1][1], dp[i][0] %= mod;
		dp[i][1] = dp[i-1][0];
		// dp[i][2] = dp[i-1][2] * 2 + dp[i-1][1], dp[i][0] %= mod;
	}
	FOR(i,1,n) {
		if(i == 1) {
			ans += (dp[n-1][0] + dp[n-1][1]) % mod * A[i] % mod, ans %= mod;
		} else {
			ans += mult(dp[n-i][0] + dp[n-i][1], dp[i-2][0] + dp[i-2][1]) % mod * A[i] % mod, ans %= mod;
			ans -= mult(dp[n-i][0], dp[i-2][0]) % mod * A[i] % mod, ans += mod, ans %= mod;
		}
	}
	cout<<ans<<'\n';
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef int64_t ll;
const ll maxOne = 1'000'000'007;
ll add(ll a, ll b){
    if(a<0){
        a += maxOne;
    }
    if(b<0){
        b += maxOne;
    }
    return (a+b)%maxOne;
}
ll mul(ll a, ll b){
    if(a<0){
        a += maxOne;
    }
    if(b<0){
        b += maxOne;
    }
    return (a*b)%maxOne;
}
ll sub(ll a, ll b){
    if(a<b){
        a += maxOne;
    }
    return (a-b)%maxOne;
}

int main() {
    ll n;
    cin >> n;
    vector<ll> vals(n);
    for(auto& val:vals){
        cin >> val;
    }
    if(n==1){
        cout << vals[0] << endl;
        return 0;
    }

    ll dpp = vals[0];
    ll dps = 0;
    ll cp = 1;
    ll cs = 0;
    for(ll i=1; i<n; i++){
        ll nextDpp = add(dpp, mul(vals[i], add(cp, cs)));
        nextDpp = add(nextDpp, dps);
        ll nextDps = sub(dpp, mul(vals[i], cp));
        ll nextCp = add(cp, cs);
        ll nextCs = cp;

        dpp = nextDpp;
        dps = nextDps;
        cp = nextCp;
        cs = nextCs;
    }
    cout << add(dpp, dps) << endl;

    return 0;
}


#include <iostream>
using namespace std;
int main(void){
    double x,y,z;cin >> x >> y >> z;
    double ta=y/x;
    for(double i=0;;i++){
        double s=i/z;
        if(s>=ta){
            cout << i-1 << endl;
            return 0;
        }
    }
}

#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = /*1'000'000'007LL;*/ 998'244'353LL;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dy[4]={ -1,0,1,0 };
const int dx[4]={ 0,-1,0,1 };

int N;
ll H[200000];
int M;
ll W[200000];

signed main(){
	cin >> N >> M;
	rep(i, N) cin >> H[i];
	rep(i, M) cin >> W[i];

	sort(H, H+N);
	sort(W, W+M);
	ll tmp = 0;
	rep(i, N){
		if(i%2 == 0) tmp += H[i];
		else tmp -= H[i];
	}

	ll ans = LLONG_MAX;
	int j = 0;
	rep(i, M){
		while(j < N && H[j] < W[i]){
			if(j%2 == 0) tmp -= 2*H[j];
			else tmp += 2*H[j];
			j++;
		}
		//cout << tmp << " " << (j%2 == 0 ? -W[i] : W[i]) << endl;
		ans = min(ans, tmp + (j%2 == 0 ? -W[i] : W[i]));
	}
	cout << ans << endl;
}


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

const int N=1005;
int par[2*N];

int find(int v){
	if(par[v]==v)return v;
	return par[v]=find(par[v]);
}
bool join(int u,int v){
	u=find(u),v=find(v);
	if(rand()%2)swap(u,v);
	par[v]=u;
	return u!=v;
}
int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    iota(par,par+2*N,0);
    int h,w;
    cin >> h >> w;
    int g[h][w];
    for(int i=0;i<h;i++){
    	for(int j=0;j<w;j++){
    		char ch;
    		cin >> ch;
    		if(ch=='#')join(i,N+j);
    	}
    }
    join(0,h-1);
    join(0,N);
    join(0,N+w-1);
    int ans=2e9;
    set <int> s;
    for(int i=0;i<h;i++)
    	s.insert(find(i));
    ans=min(ans,(int)s.size()-1);
    s.clear();
    for(int i=0;i<w;i++)
    	s.insert(find(N+i));
    ans=min(ans,(int)s.size()-1);
    cout << ans;
}

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

using namespace std;

#define PB push_back
#define f fiCrst
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const int INF = 1000000007;
const ll MOD = 998244353;

int dp[3001][3001];

void solve_test()
{
    int n, k;
    cin >> n >> k;
    dp[0][0] = 1;
    for(int i=1; i<=n; i++)
    {
        for(int j=n; j>=1; j--)
        {
            if(j > i)
                continue;
            dp[i][j] = dp[i-1][j-1];
            if(j * 2 <= i)
                dp[i][j] = (dp[i][j] + dp[i][2*j]) % MOD;
        }
    }
    cout << dp[n][k];

}

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tests;
    tests = 1;
    //cin >> tests;
    while(tests--)
    {
        solve_test();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 10000007
#define F for(int i=0;i<n;i++)
#define raftaar ios_base::sync_with_stdio(false);cin.tie(NULL);
#define shuru int t;cin>>t;while(t--)
int SieveOfEratosthenes(int n)
{

    bool prime[n + 1];int c=0;
    memset(prime, true, sizeof(prime));

    for (int p = 2; p * p <= n; p++)
    {

        if (prime[p] == true)
        {

            for (int i = p * p; i <= n; i += p)
                prime[i] = false;
        }
    }

    for (int p = 2; p <= n; p++){
        if (prime[p]) c++;}
        return c;
}

signed main() {
    // shuru{
    // int c=0;
       string s;cin>>s;string a;
       reverse(s.begin(),s.end());
       for(int i=0;i<s.size();i++){
           if(s[i]=='9') s[i]='6';
           else if(s[i]=='6') s[i]='9';
           else continue;
       }
       cout<<s<<endl;
}

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

typedef long long ll;
typedef unsigned long long ull;

#define mp make_pair
#define fr first
#define sc second

int n;
int p[502];
vector<int> ret;

void add(int i){
	ret.push_back(i);
	swap(p[i],p[i+1]);
}

void solve(int k){
	//cerr<<k<<" "<<ret.size()<<endl;
	if(k==1)return;
	if(k==2){
		if(p[0]!=0)add(0);
		return;
	}
	if(k==3){
		while(p[2]!=2){
			add(0);
			add(1);
		}
		solve(2);
		return;
	}
	int loc=0;
	for(int i=0;i<k;i++){
		if(p[i]==k-1){
			loc=i;
			break;
		}
	}
	if(loc==k-1){
		solve(k-1);
		return;
	}
	if(loc%2==0){
		while(loc!=k-1){
			add(loc);
			loc++;
		}
		if(ret.size()%2!=0)add(1);
		solve(k-1);
		return;
	}
	else {
		if(loc>=3)add(loc-3);
		else add(loc+1);
		while(loc!=k-1){
			add(loc);
			loc++;
		}
		if(ret.size()%2!=0)add(1);
		solve(k-1);
		return;
	}
}

int main(){
	int T;
	scanf("%d",&T);
	for(;T>0;T--){
		scanf("%d",&n);
		for(int i=0;i<n;i++){
			scanf("%d",&p[i]); p[i]--;
		}
		ret.clear();
		solve(n);
		printf("%d\n",(int)ret.size());
		if(ret.size()==0)puts("");
		else {
			for(int i=0;i<ret.size();i++){
				printf("%d%c",ret[i]+1,(i+1==ret.size())?'\n':' ');
			}
		}
	}
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define p_b pop_back
using namespace std;

int main(){
    int n, sum = 0;
    cin >> n;

    vector<int> v1, v2;
    for(int i = 0; i < n; i++){
        int k;
        cin >> k;
        v1.pb(k);
    }
    for(int i = 0; i < n; i++){
        int k;
        cin >> k;
        v2.pb(k);
    }

    for(int i = 0; i < n; i++){
        sum += v1[i]*v2[i];
    }

    if(sum == 0){
        cout << "Yes\n";
    } else{
        cout << "No\n";
    }
    return 0;
}

//
//  main.cpp
//  rferf
//
//  Created by Harshita Hazarika on 28/12/20.
//  Copyright © 2020 Harshita Hazarika. All rights reserved.
//

#include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <iterator>
#include <map>
#include<climits>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include<cmath>
#include <unordered_set>

using namespace std;
typedef long long int ll;

ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0){
        if (y & 1)  res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll modInverse(ll n, ll p)
{
    return power(n, p-2, p);
}

void solve()
{
    ll n;
    cin>>n;
    string str="";
    set<string>st;
    bool flag=false;
    for(ll i=0;i<n;i++){
        string s;
        cin>>s;
        if(!flag){
        if(s[0]=='!'){
            if(st.find(s.substr(1))!=st.end()){
                str=s.substr(1);
                flag=true;
            }
        }
        else{
           if(st.find("!"+s)!=st.end()){
                str=s;
               flag=true;
            }
        }
        st.insert(s);
    }

    }
    if(flag){
        cout<<str<<"\n";
    }
    else{
        cout<<"satisfiable\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    int t;
//    cin >> t;
//    while(t--)
      solve();

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c> {i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
    ~debug() { cerr << endl; }
    eni( != ) cerr << boolalpha << i; ris;
}
eni( == ) ris << range(begin(i), end(i));
}
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
    sim dor(const c&) { ris; }
#endif
};
#define imie(...)"Line: "<<__LINE__<<" -> " " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
#define int long long
vector<int> a;
int sz;
int calc(vector<int> &arr, bool pari){
    map<int, int> mappa;
    int ans = 0;
    int n = (int)arr.size();
    vector<int> pref(n + 1);
    for(int i = 1; i <= n; i++){
        if(i == 1){
            pref[i] = arr[i - 1];
        }
        else{
            pref[i] = arr[i - 1] + pref[i - 1];
        }
    }
    debug() << imie(arr) imie(pref) imie(pari);
    for(int i = 1; i <= n; i++){
        if(pref[i] == 0){
            ans++;
        }
        int posizione = sz + 1;
        if(pari){
            posizione = i * 2 + 1;
        }
        else{
            posizione = i * 2 + 2;
        }
        if(posizione <= sz){
            int currp = pref[i] + a[posizione];
            debug() << imie(posizione) imie(a[posizione]) imie(i) imie(pari);
            ans += mappa[currp];
            ans += (currp == 0 ? 1 : 0);
        }
        ans += mappa[pref[i]];
        mappa[pref[i]]++;
    }
    return ans;
}
int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int n;
    cin >> n;
    sz = n;
    vector<int> dispari, pari;
    a.resize(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 1; i < n; i += 2){
        dispari.push_back(a[i] - a[i + 1]);
    }
    for(int i = 2; i < n; i += 2){
        pari.push_back(a[i] - a[i + 1]);
    }
    debug() << imie(dispari) imie(pari);
    int ans = calc(pari, false) + calc(dispari, true);
    cout << ans << '\n';
}

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

#define M1 1000000007
#define M2 998244353
#define INF 1e18
#define ll long long
#define pll pair<ll,ll>
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define REPR(i,a,b) for(ll i=b-1;i>=a;i--)
#define forr(i,n) for(ll i=0;i<n;i++)
#define F first
#define S second
#define pb push_back
#define DB pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<int>
#define vlli vector <long long>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)

/********************************************************************/
const double pi = 3.1415926535;
/********************************************************************/
//FAST IO//
void FAST() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

/********************************************************************/
int main()
{
  FAST();

  int n; cin>>n; vi a(n); forr(i,n) {cin>>a[i]; }

  map <int, int> M;
  for (int i=0; i<n; i++)
  {
    int x=a[i];
    for (int i=2; i*i<x; i++)
    {
      if (x%i==0){ M[i]++;}
      while (x%i==0) {x/=i; }
    }
    if (x!=0 && x!=1){M[x]++; }

  }

  auto it=M.begin();
  int stor=-1;
  int ans=0;
  while (it !=M.end())
  {
    if ((*it).S > ans) {stor=(*it).F; }
    ans=max(ans, (*it).S);
    it++;
  }
 cout<<stor<<endl;
}


#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007LL

typedef long long ll;
typedef pair<ll,ll> P;

ll tate[2002][2002];
ll yoko[2002][2002];
ll nana[2002][2002];
ll dp[2002][2002];
char mp[2002][2002];

void mod_add(ll &a, ll b) {
	a += b;
	a %= MOD;
}

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

	ll h, w;cin >> h >> w;
	REP(i, h) {
		REP(j, w) {
			cin >> mp[i][j];
		}
	}

	dp[0][0] = 1;
	tate[0][0] = 1;
	yoko[0][0] = 1;
	nana[0][0] = 1;
	REP(i, h) {
		REP(j, w) {
			if (mp[i][j] == '#') continue;
			if (i == 0 && j == 0) continue;

			if (i > 0) mod_add(dp[i][j], tate[i-1][j]);
			if (j > 0) mod_add(dp[i][j], yoko[i][j-1]);
			if (i > 0 && j > 0) mod_add(dp[i][j], nana[i-1][j-1]);

			tate[i][j] += dp[i][j];
			yoko[i][j] += dp[i][j];
			nana[i][j] += dp[i][j];

			if (i > 0) {
				mod_add(tate[i][j], tate[i-1][j]);
			}
			if (j > 0) {
				mod_add(yoko[i][j], yoko[i][j-1]);
			}
			if (i > 0 && j > 0) {
				mod_add(nana[i][j], nana[i-1][j-1]);
			}
		}
	}

	// SHOW2d(dp, h, w);

	cout << dp[h-1][w-1] << endl;

	return 0;
}

#include <bits/stdc++.h>
using  namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll                     long long
#define endl                   "\n"
#define V                      vector<ll>
#define VT(A)                  vector
#define P                      pair<ll, ll>
#define ST(A)                  set
#define US(A)                  unordered_set
#define M                      map<ll, ll>
#define MT(A,B)                 map
#define UM(A,B)                unordered_map
#define PQ(A)                  priority_queue
#define HP(A)                  priority_queue<A, vector<int>, greater>
#define F                      first
#define S                      second
#define T                      top()
#define B                      back()
#define PU                     push
#define PO                     pop()
#define PB                     push_back
#define POB                    pop_back
#define EB                     emplace_back
#define MP                     make_pair
#define MOD                    1e9 + 7
#define INF                    100000000000000003
#define IN(a)                  cin >> (a)
#define PE(a)                  cout << (a) << endl
#define PS(a)                  cout << (a) << " "
#define PSS(a,b)               cout << (a) << " " << (b) << endl;
#define MAX(a, b)              ((a) < (b) ? (b) : (a))
#define MIN(a, b)              ((a) > (b) ? (b) : (a))
#define ALL(v)                 (v).begin(), (v).end()
#define FOR(a, b, c, s)        for (ll (a) = (b); (a) < (c); (a)+=s)
#define FORL(a, b, c, s)       for (ll (a) = (b); (a) <= (c); (a)+=s)
#define FORR(a, b, c, s)       for (ll (a) = (b); (a) >= (c); (a)-=s)
#define FORA(i, a)             for(auto& (i) : (a))
#define N                      1e7+10

void init_code()
{
    fast;
    //seive();
}

void solve()
{
    // Jai Shree Ram
    ll h,w,x,y;
    cin >> h >> w >> x >> y;

    x--, y--;
    vector<string> s(h);
    FOR(i,0,h,1) IN(s[i]);

    ll res = -3;

    for(ll i=x; i<h && s[i][y] == '.'; i++) res++;
    for(ll i=x; i>=0 && s[i][y] == '.'; i--) res++;
    for(ll j=y; j<w && s[x][j] == '.'; j++) res++;
    for(ll j=y; j>=0 && s[x][j] == '.'; j--) res++;

    PE(res);
}

int main() {

    init_code();

    solve();

    return 0;
}


#include<bits/stdc++.h>
using ll = long long;
#define REP(i, n) for (ll i = 0; (i) < ll(n); ++ (i))
#define FOR(i, m, n) for (ll i = (m); (i) <= ll(n); ++ (i))
#define REPR(i, n) for (ll i = ll(n) - 1; (i) >= 0; -- (i))
#define FOR3R(i, m, n) for (ll i = ll(n) - 1; (i) >= ll(m); -- (i))
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second

#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;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>> //VVI a(n, vector<int>(m));
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)

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;
}
template <class T>
T GCD(T a, T b) {
	if (b == 0)
		return a;
	else
		return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
	return (a * b) / GCD(a, b);
}

using namespace std;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  //小数の桁数の出力指定
  //cout<<fixed<<setprecision(10);
  int n;
	 cin >> n;
	 vector<ll> a(n+1,0), b(n+1,0), bt(n+1,0);
	 int t;
	 REP(i,n) {
		 cin >> t;
		 ++a[t];
	 }
	 REP(i,n){
	 	 cin >> b[i];
	 }
	 REP(i,n) {
		 cin >> t;
		 ++bt[b[t-1]];
	 }

	 ll c = 0;
	 REP(i,n+1){
		 c += a[i] * bt[i];
	 }
	 cout << c << endl;
}

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

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (ll)(n); i++)
#define BIT(bit, n) for (int bit = 0; bit < (1 << (n)); ++bit)
#define INF 1000000000
//配列 vector<型> 配列名(要素数, 初期値);
//二次元配列 vector<vector<型>> 配列名(要素数縦,vector<int>(要素数横, 初期値))
//配列のサイズ(二次元縦) 配列名.size(), 二次元横 配列名[0].size()
// 1秒間のforループは10^8くらい
//小数点桁数 cout << fixed << setprecision(20) <<
// bit全探索 条件判定 if(bit & (1 << n))

int main() {
  int N;
  cin >> N;
  vector<pair<ll, ll>> x(N);
  vector<pair<ll, ll>> y(N);
  vector<pair<ll, ll>> ans(6);
  vector<pair<ll, ll>> check(6);

  REP(i, N) {
    cin >> x[i].first >> y[i].first;
    x[i].second = i;
    y[i].second = i;
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());

  ans[0].first = abs(x[0].first - x[N - 1].first);
  ans[1].first = abs(x[0].first - x[N - 2].first);
  ans[2].first = abs(x[1].first - x[N - 1].first);
  ans[3].first = abs(y[0].first - y[N - 1].first);
  ans[4].first = abs(y[0].first - y[N - 2].first);
  ans[5].first = abs(y[1].first - y[N - 1].first);

  check[0].first = x[0].second;
  check[1].first = x[0].second;
  check[2].first = x[1].second;
  check[3].first = y[0].second;
  check[4].first = y[0].second;
  check[5].first = y[1].second;

  check[0].second = x[N - 1].second;
  check[1].second = x[N - 2].second;
  check[2].second = x[N - 1].second;
  check[3].second = y[N - 1].second;
  check[4].second = y[N - 2].second;
  check[5].second = y[N - 1].second;

  REP(i, 6) { ans[i].second = i; }

  sort(ans.begin(), ans.end());

  if (check[ans[4].second].first != check[ans[5].second].first ||
      check[ans[4].second].second != check[ans[5].second].second) {
    cout << ans[4].first << endl;
  } else {
    cout << ans[3].first << endl;
  }
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
#define fst first
#define snd second

template <typename T>
istream &operator>>(istream &in, vector<T> &v) {
  for (auto &x : v)
    in >> x;
  return in;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  for (const auto &x : v)
    out << x << ' ';
  return out;
}

template <typename T>
vector<T> scanl1(function<T(T, T)> f, const vector<T> &v) {
  vector<T> r(v.size());
  r[0] = v[0];
  for (int i = 1; i < (int)v.size(); i++) {
    r[i] = f(r[i - 1], v[i]);
  }
  return r;
}

template <typename T, typename A = T, typename B = T>
vector<T> zipWith(function<T(A, B)> f, const vector<A> &va,
                  const vector<B> &vb) {
  vector<T> vt(min(va.size(), vb.size()));
  for (int i = 0; i < (int)vt.size(); i++) {
    vt[i] = f(va[i], vb[i]);
  }
  return vt;
}

int main() {
#ifdef LOCAL_EXEC
  freopen("sample.in", "r", stdin);
  freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#endif

  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  cin >> a >> b;

  a = scanl1<ll>([](ll a, ll b) { return max(a, b); }, a);
  a = zipWith<ll, ll, ll>([](ll a, ll b) -> ll { return a * b; }, a, b);
  a = scanl1<ll>([](ll a, ll b) { return max(a, b); }, a);

  cout << a << endl;

  return 0;
}

#include<iostream>
#include<cstdio>
#include<queue>
#define int long long
#define uc getchar()
#define ph putchar
#define R register
#define CN const
#define rint R int
#define cint CN int
#define ps ph(' ')
#define pe ph('\n')
using namespace std;
cint inf=1e9+7;
cint mix=2e5+5;
inline int in();
inline void out(rint y);
int n=in(),a[mix],mx,ans;
#undef int
int main() {
#define int long long
	for(rint i=1;i<=n;++i)a[i]=in();
	for(rint i=1;i<=n;++i){
		mx=max(mx,a[i]);
		out(ans=max(ans,mx*in())),pe;
	}
}
inline int in() {
	rint x=0;
	R bool f=0;
	R char s=uc;
	while((s<'0'||'9'<s)&&s!='-')s=uc;
	if(s=='-')f=1,s=uc;
	while('0'<=s&&s<='9')(x*=10)+=s^48,s=uc;
	return f?-x:x;
}
inline void out(rint x) {
	if(x<0)ph('-'),x=-x;
	rint y=x/10;
	if(y)out(y);
	ph((x-y*10)^48);
}