//Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#define endl "\n"
#define mini -10000000000000000
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define f(i, a, n) for( i=a; i<n;i++)
#define ll long long
#define pi 3.141592653589793
#define vi              vector<int>
#define si              set<int>
#define pb              push_back
#define mp              make_pair
#define mod             1000000000000000000
#define rr              return 0
#define ff              first
#define in              insert
#define ss              second
#define all(a) a.begin(), a.end()
typedef pair<int, int> pii;
#define setbits(x)      builtin_popcountll(x)
#define zrbits(x)       builtin_ctzll(x)
#define deb(x)          cout << #x << " = " << x << endl
#define set_bit(x, idx) x = x|1LL<<idx
#define check_bit(x, idx) min(x&(1LL<<idx),1LL)
#define toggle_bit(x, idx) x = x^(1LL<<idx)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using    namespace __gnu_pbds;
#define multi_ordered_set       tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update> rordered_set;
#ifdef DEBUG
#define ok cerr << __LINE__ <<"is done "<<endl;
#else
#define ok
#endif
ll ncr[1001][1001];
void calcncr()
{
  for(int i = 0; i <= 1000; i++)
  {
    ncr[i][0] = 1;
  }
  for(int i = 1; i <= 1000; i++)
  {
    for(int j = 1; j <= 1000; j++)
    {
      ncr[i][j] = (ncr[i-1][j-1] + ncr[i-1][j])%mod;
    }
  }
}
int main()
{
    ios;
    #ifdef DEBUG
    freopen("in", "r", stdin);
    #endif
    ll i,j,n,m,k;
	ll t;
	t=1;
    calcncr();
	//cin>>t;
	while(t--)
	{
        ll l;
      cin>>l;
      cout<<ncr[l-1][l-12]<<endl;
	}
    rr;
}

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) { os << ','; }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = (1<<30)-1;
const ll linf = 1LL<<61;
const int MAX = 510000;
int dy[8] = {0,1,0,-1,1,-1,-1,1};
int dx[8] = {-1,0,1,0,1,-1,1,-1};
const double pi = acos(-1);
const double eps = 1e-9;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    int sz = a.size();
    for(auto itr = a.begin(); itr != a.end(); itr++){
		cout << *itr;
        sz--;
        if(sz) cout << " ";
	}
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){
	cout << a << " " << b << "\n";
}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
void mark() {cout << "#" << "\n";}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;

struct UnionFind{
    vl p;
    vl rank;
    vl cnt;

    UnionFind(ll n){
        rank.resize(n,0);
        p.resize(n,0);
        cnt.resize(n,0);
        rep(i,n){
            p[i] = i;
            rank[i] = 0;
            cnt[i] = 1;
        }
    }

    ll find(ll x){
        if(x != p[x]) p[x] = find(p[x]);
        return p[x];
    }

    bool same(ll x, ll y){
        return find(x) == find(y);
    }

    void unite(ll x, ll y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(rank[x] > rank[y]){
            p[y] = x;
            cnt[x] += cnt[y];
        }else{
            p[x] = y;
            cnt[y] += cnt[x];
            if(rank[x] == rank[y]) rank[y]++;
        }
    }

    ll size(ll x){
        return cnt[find(x)];
    }
};

UnionFind uf(202020);

int main(){
    int n; cin >> n;
    vl a(n); rep(i,n) cin >> a[i];
    int ans = 0;
    rep(i,n/2){
        if(uf.same(a[i],a[n-i-1])) continue;
        uf.unite(a[i],a[n-i-1]);
        ans++;
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define inf 1000000000000000001
#define mod 1000000007
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise fixed(cout);cout<<setprecision(16);
#define Set(N,p) N=((N)|((1LL)<<(p)))
#define Reset(N,p) N=((N)&(~((1LL)<<(p))))
#define Check(N,p) (!(((N)&((1LL)<<(p)))==(0)))
#define POPCOUNT __builtin_popcountll
#define RIGHTMOST __builtin_ctzll
#define LEFTMOST(x) (63-__builtin_clzll((x)))
#define NUMDIGIT(x,y) (((vlong)(log10((x))/log10((y))))+1)
#define OUT(x) for(auto a:x) cout << a << " "; cout << endl;
#define OK cout << "@===================ok===================@" <<endl;
#define WTF cout <<"< "<<lo<<" | "<< hi <<" >" << endl;

using namespace std;

int main()
{
    ll n,x;
    cin >> n >> x;
    string s;
    cin >> s;
    ll res=x;
    for(auto a:s){
        if(a=='x') res--;
        else res++;
        if(res<0) res=0;
    }
    cout << res <<"\n";
}

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

#define all(x) (xi).begin(), (x).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define un_map unordered_map
#define rep(i,a,n) for (int i = a; i < n; ++i)
#define rrep(i,a,n) for (int i = a; i >= n; --i)
#define irep(i,a,n,inc) for (int i = a; i < n; i += inc)
#define endl "\n"

typedef long long ll;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define int long long

int power_mod(int a, int b, int mo) {
	int ans = 1;
	while (b) {
		if(b & 1) {
			ans = (ans % mo * a % mo) % mo;
		}
		a = (a % mo * a % mo) % mo;
		b /= 2;
	  }
	return ans;
}

void print(vector<vector<int>> &v) {
  for (int i = 0; i < (int)v.size(); ++i) {
    cout << i << " : ";
    for (int j = 0; j < (int)v[i].size(); ++j) {
      cout << v[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
}

int32_t main() {
   int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  vector<int> m(4e5);
  vector<vector<int>> ans(4e5);
  for (int i = 0; i < n; ++i) {
    ans[m[v[i]]].push_back(v[i]);
    m[v[i]]++;
  }
  for (int i = 0; i < 4e5; ++i) {
    sort(ans[i].begin(), ans[i].end());
  }
  //int maxm = *max_element(all(v));
  int sum = 0;
  vector<int> res;
  for (int i = 0; i < 4e5; ++i) {
    int size = (int)ans[i].size();
    //if (size) {
      //debug(i, ans[i]);
      int p = -1;
      //int val = ans[i][size - 1];
      for (int j = 0; j < size; ++j) {
        if (ans[i][j] == p + 1) p++;
        else break;
      }
      //debug(p, val);
      //if (p == val + 1) {
        res.push_back(p + 1);
     // }
   // }
  }
  sort(res.rbegin(), res.rend());
  for (int i = 0; i < k; ++i) {
    sum += res[i];
  }
  cout << sum;
}


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

int main(void) {
    int n; cin>> n;
    cout << n - 1 << endl;
}

#include <bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define debug(output) if(debugFlag)cout<<#output<<"= "<<output<<endl
using lint = long long;
typedef pair<int,int> P;
const bool debugFlag=true;
const lint linf=1e18+7;
const lint inf=1e9+7;
const int MOD=1000000007;
signed main(){
  int n;cin>>n;
  cout<<max(0,n-1)<<endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
int main(void){
    // Your code here!
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
 ll i,ans,m,n,s;
 ans=INT_MAX;
 cin >> n >> m;
 ll a[n],c[n];
 vector<ll> v(n),b(m);
 for(i=0;i<n;i++)
 cin >> v[i];
 for(i=0;i<m;i++)
 cin >> b[i];
 if(n==1)
 {
  for(i=0;i<m;i++)
  ans=min(ans,abs(b[i]-v[0]));
  cout << ans;
  return 0;
 }
 sort(v.begin(),v.end());
 for(i=1;i<n;i++)
 {
  a[i]=v[i]-v[i-1];
  c[i-1]=v[i]-v[i-1];
 }
 for(i=2;i<n;i++)
 {
  a[i]+=a[i-2];
  c[n-i-1]+=c[n-i+1];
 }
 for(i=0;i<m;i++)
 {
  auto it=lower_bound(v.begin(),v.end(),b[i]);
  s=0;
  if(b[i]>=v[n-1])
  s=a[n-2]+b[i]-v[n-1];
  else if(b[i]<=v[0])
  s=c[1]+v[0]-b[i];
  else if((it-v.begin())%2)
  {
   s+=c[it-v.begin()];
   s+=b[i]-v[it-v.begin()-1];
   if((it-v.begin())!=1)
   s+=a[it-v.begin()-2];
  }
  else
  {
   if(it!=v.begin())
   s+=a[it-v.begin()-1];
   s+=v[it-v.begin()]-b[i];
   if((it-v.begin())!=(n-1))
   s+=c[it-v.begin()+1];
  }
  ans=min(ans,s);
  //cout << s << " ";
 }
 cout << ans;
 return 0;
}

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

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

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

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

  ll H[N];
  rep(i, N) {
    cin >> H[i];
  }
  sort(H, H+N);

  vector<ll> left(N/2), right(N/2);
  rep(i, N/2) {
    left[i] = H[2*i+1] - H[2*i];
    right[i] = H[2*(i+1)] - H[2*i+1];

  }

  vector<ll> left_sum(N/2 + 1, 0), right_sum(N/2+1, 0);
  rep(i, N/2) {
    left_sum[i+1] = left_sum[i] + left[i];
    right_sum[i+1] = right_sum[i] + right[i];
  }

  vector<ll> W(M);
  rep(i, M) {
    cin >> W[i];
  }

  ll ans = 10000000000000000;

  rep(i, M) {
    // 先生を初めて超えるindex
    int x = lower_bound(H, H +N, W[i]) - H;

    if (x % 2) {
      chmin(ans, left_sum[(x-1)/2] + (W[i]-H[x-1])
          + right_sum[(N-1)/2] - right_sum[(x-1)/2]);
    } else {
      chmin(ans, left_sum[x/2] + (H[x]-W[i])
            + right_sum[(N-1)/2] - right_sum[x/2]);
    }
  }

  cout << ans << endl;

}


#include<stdio.h>
#include<algorithm>
#include<random>
#include<queue>
#include<map>
#include<time.h>
#include<string>
using namespace std;
using lld = long long int;
using pii = pair<int, int>;
using pll = pair<lld, lld>;
using pli = pair<lld, int>;
using pil = pair<int, lld>;
using lf = double;
int n, m;
int lv[200009];
int dv[200009];
int a[200009];
int b[200009];
int al, bl;
#define I 262144
lld ms[2 * I];
lld getms(int dep, int ql, int qr, int ll, int rr) {
    if (ql <= ll && rr <= qr)return ms[dep];
    if (qr < ll || rr < ql)return 0;
    return getms(dep * 2, ql, qr, ll, (ll + rr) / 2) + getms(dep * 2 + 1, ql, qr, (ll + rr) / 2 + 1, rr);
}
void updatems(int i, int k) {
    i += I;
    while (i > 0) {
        ms[i]+=k;
        i >>= 1;
    }
}
vector<int> rv[200009];
int main()
{
    int i, j, k, l;
    int t = 1, tv = 0;
    while (t--) {
        scanf("%d %d", &n, &m);
        for (i = 0; i < n; i++) {
            lv[i] = m;
        }
        for (i = 0; i < m; i++) {
            dv[i] = n;
        }
        int p;
        scanf("%d", &p);
        while (p--) {
            scanf("%d %d", &i, &j);
            i--; j--;
            lv[i] = min(lv[i], j);
            dv[j] = min(dv[j], i);
        }
        lld res = 0;
        al = dv[0];
        for (i = 0; i < al; i++) {
            a[i] = lv[i];
            res += a[i];
            updatems(i, 1);
            rv[a[i]].push_back(i);
        }
        bl = lv[0];
        for (i = 0; i < bl; i++) {
            b[i] = dv[i];
            res += b[i];
            res -= getms(1, 0, b[i] - 1, 0, I - 1);
            for (auto it : rv[i]) {
                updatems(it, -1);
            }
        }
        printf("%lld\n", res);

    }
}

// Created by ash_98

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

#define Gene template< class
#define Rics printer& operator,
Gene c> struct rge{c b, e;};
Gene c> rge<c> range(c i, c j){ return {i, j};}
struct printer{
    ~printer(){cerr<<endl;}
    Gene c >Rics(c x){ cerr<<boolalpha<<x; return *this;}
    Rics(string x){cerr<<x;return *this;}
    Gene c, class d >Rics(pair<c, d> x){ return *this,"(",x.first,", ",x.second,")";}
    Gene ... d, Gene ...> class c >Rics(c<d...> x){ return *this, range(begin(x), end(x));}
    Gene c >Rics(rge<c> x){
        *this,"["; for(auto it = x.b; it != x.e; ++it)
            *this,(it==x.b?"":", "),*it; return *this,"]";}
};
#define debug() cerr<<"LINE "<<__LINE__<<" >> ", printer()
#define dbg(x) "[",#x,": ",(x),"] "
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int my_rand(int l, int r) {
    return uniform_int_distribution<int>(l, r) (rng);
}

#define mx 200005
#define ll long long
#define mod 1000000007

char ch[mx];
int n,m,ii,k;
int row[mx],col[mx];

namespace Segment_Tree
{
	const int N=200005;
	vector<int>Tree[N*4];
	int Lazy[mx*4];
	int ar[N];

	void Relax(int node,int be,int en)
	{
		if(!Lazy[node])return;

	//	Tree[node]+=Lazy[node];
		if(be!=en)
		{
			 Lazy[node*2]+=Lazy[node];

			Lazy[node*2+1]+=Lazy[node];

		}
		Lazy[node]=0;
	}

	void init(int node,int be,int en)
	{
		//Lazy[node]=0;
        if(be==en)
        {
        	Tree[node].push_back(ar[be]);
        	return;
        }
        int mid=(be+en)/2;
        init(node*2,be,mid);
        init(node*2+1,mid+1,en);
        merge(Tree[node*2].begin(),Tree[node*2].end(),Tree[node*2+1].begin(),Tree[node*2+1].end(),back_inserter(Tree[node]));

	}

	int query(int node,int be,int en,int i,int j,int val)
	{
		//Relax(node,be,en);
		if(be>j || en<i)return 0;
		if(be>=i && en<=j)
		{

            int st=0,fi=Tree[node].size()-1;
            int sz=Tree[node].size();
            int re=sz;

            while(st<=fi)
            {
            	int mid=(st+fi)/2;
            	if(Tree[node][mid]>=val)
            	{
            		re=mid;
            		fi=mid-1;
            	}
            	else st=mid+1;
            }

            return sz-re;
		}

		int mid=(be+en)/2;

		return (query(node*2,be,mid,i,j,val)+query(node*2+1,mid+1,en,i,j,val));
	}

	void dbg_test(int node,int be,int en)
	{
		if(be==en)return;
		int mid=(be+en)/2;
		dbg_test(node*2,be,mid);
		dbg_test(node*2+1,mid+1,en);
	}
}

using namespace Segment_Tree;

void solve()
{
	scanf("%d%d%d",&n,&m,&k);

	for(int i=1;i<=n;i++)row[i]=m;
	for(int i=1;i<=m;i++)col[i]=n;

	for(int i=1;i<=k;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		col[y]=min(col[y],x-1);
		row[x]=min(row[x],y-1);
	}

	ll re=0;
	int limi=row[1];
	re+=limi-1;
	for(int i=2;i<=limi;i++)
	{
		int jabe=col[i];
		re+=jabe-1;
		ar[i]=jabe;
		//cout<<i<<" "<<jabe<<endl;
	}

	init(1,1,m);

	limi=col[1];
	re+=limi;

	//cout<<re<<endl;

	for(int i=2;i<=limi;i++)
	{
		int r=row[i];
		int jabe=query(1,1,m,2,r,i);
        //cout<<i<<" "<<r-1<<" "<<jabe<<endl;
		re-=jabe;
		re+=r-1;

	}
	printf("%lld\n",re);
}

int main()
{
	int t=1;
	//scanf("%d",&t);
	while(t--)solve();
	return 0;
}


//Problem link :
//done by sanath kumar
#include<bits/stdc++.h>
using namespace std;
#define ll      			long long int
#define ld      			long double
#define mod     			1000000007
#define inf     			1e9
#define endl    			"\n"
#define pb      			push_back
#define vi 					vector<ll>
#define vs					vector<string>
#define pii 				pair<ll,ll>
#define ump 				unordered_map
#define mp 					make_pair
#define pq_max  			priority_queue<ll>
#define pq_min				priority_queue<ll,vector<ll>,greater<ll>>
#define all(v)				v.begin(),v.end()
#define ff 					first
#define ss					second
#define mid(l,r)    		(l+(r-l))/2
#define bitc(x)				__builtin_popcount(x)
#define loop(i,a,b)			for(int i=(a);i<=(b);i++)
#define looprev(i,a,b) 		for(int i=(a);i>=(b);i--)
#define iter(c,it)			for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define log(args...)		{string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);err(_it,args);}
#define logarr(arr,a,b)		for(int z=(a);z<=(b);z++) cout<<(arr[z])<<" ";cout<<endl;
template<typename T> T gcd(T a,T b) {if(b==0) return a; return gcd(b,a%b);}
template<typename T> T lcm(T a,T b) {return a*(b/gcd(a,b));}

void err(istream_iterator<string> it){}
template<typename T,typename... Args>
void err(istream_iterator<string> it,T a,Args... args){
	cout<<*it<<" = "<<a<<endl;
	err(++it,args...);
}

void file_i_o(){
	ios_base::sync_with_stdio(false);

	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
}
int main(){
	file_i_o();
	clock_t begin=clock();
	string S;
	cin>>S;
	int n=S.length();
	loop(i,0,n-1){
		if(S[i]=='9') S[i]='6';
		else if(S[i]=='6') S[i]='9';
	}
	looprev(i,n-1,0){
		cout<<S[i];
	}

	#ifndef ONLINE_JUDGE
		clock_t end=clock();
		cout<<"\n\n\nExecuted in :"<<double(end-begin)/CLOCKS_PER_SEC*1000<<" ms"<<endl;
	#endif
}

#include<stdio.h>
#include<string.h>
char ch[101000];
int main(){
	scanf("%s",ch+1);
//	scanf("%d%d%d",&a,&b,&c);
//	printf("%d",21-a-b-c);
	int len = strlen(ch+1);
	for(int i = len;i>=1;i--){
		if(ch[i]=='0'||ch[i]=='1'||ch[i]=='8'){
			printf("%c",ch[i]);
		}
		else {
			if(ch[i]=='6'){
				printf("9");
			}
			else {
				printf("6");
			}
		}
	}
	return 0;
}


#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 repab(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repr(i, n) for (ll i = (ll)(n); i >= 0; i--)
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>{})

//定数
#define INF32 2147483647           // 2.147483647×10^{9}:32bit整数のinf
#define INF64 9223372036854775807  // 9.223372036854775807×10^{18}:64bit整数のinf
#define MOD 1000000007             //問題による

int main() {
  ll n, s, d;
  cin >> n >> s >> d;

  vector<ll> x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];

  string ans = "No";
  rep(i, n) {
    if (x[i] >= s) continue;
    if (y[i] <= d) continue;
    ans = "Yes";
    break;
  }

  cout << ans << endl;
}

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

int main(){
  int A,B,W;
  cin >> A >> B >> W;
  W*=1000;
  int mi=1e9;
  int ma=-1;
  for(int i=1;i<=1e6;i++){
    if(A*i>W){
      break;
    }else if(B*i<W){
      continue;
    }else{
      mi=min(mi,i);
      ma=max(ma,i);
    }
  }
  if(ma==-1){
    cout << "UNSATISFIABLE" << endl;
  }else{
    cout << mi << " " << ma << endl;
  }
  return 0;
}


/*  -*- coding: utf-8 -*-
 *
 * f.cc: F - Graph Smoothing
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100;
const int MOD = 1000000007;

/* typedef */

typedef long long ll;

struct MI {
  int v;
  MI(): v() {}
  MI(int _v): v(_v) {}

  MI operator+(const MI m) const { return MI((v + m.v) % MOD); }
  MI operator-(const MI m) const { return MI((v + MOD - m.v) % MOD); }
  MI operator*(const MI m) const { return MI((ll)v * m.v % MOD); }

  MI &operator+=(const MI m) { return (*this = *this + m); }
  MI &operator-=(const MI m) { return (*this = *this - m); }
  MI &operator*=(const MI m) { return (*this = *this * m); }

  MI pow(int n) {  // a^n % MOD
    MI pm = 1, a = *this;
    while (n > 0) {
      if (n & 1) pm *= a;
      a *= a;
      n >>= 1;
    }
    return pm;
  }

  MI inv() { return pow(MOD - 2); }
};

typedef MI vec[MAX_N];
typedef vec mat[MAX_N];

/* global variables */

vec va, vb;
mat ma, mb;

/* subroutines */

inline void initmat(const int n, mat a) { memset(a, 0, sizeof(mat)); }

inline void unitmat(const int n, mat a) {
  initmat(n, a);
  for (int i = 0; i < n; i++) a[i][i] = 1;
}

inline void copymat(const int n, const mat a, mat b) {
  memcpy(b, a, sizeof(mat));
}

inline void mulmat(const int n, const mat a, const mat b, mat c) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      c[i][j] = 0;
      for (int k = 0; k < n; k++)
        c[i][j] += a[i][k] * b[k][j];
    }
}

inline void powmat(const int n, const mat a, int b, mat c) {
  mat s, t;
  copymat(n, a, s);
  unitmat(n, c);

  while (b > 0) {
    if (b & 1) {
      mulmat(n, c, s, t);
      copymat(n, t, c);
    }

    mulmat(n, s, s, t);
    copymat(n, t, s);
    b >>= 1;
  }
}

inline void mulmatvec(const int n, const mat a, const vec b, vec c) {
  for (int i = 0; i < n; i++) {
    c[i] = 0;
    for (int j = 0; j < n; j++) c[i] += a[i][j] * b[j];
  }
}

/* main */

int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);

  for (int i = 0; i < n; i++) scanf("%d", &(va[i].v));

  unitmat(n, ma);
  MI inv2m = (MI(2) * m).inv();

  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--, y--;

    ma[x][x] -= inv2m, ma[x][y] += inv2m;
    ma[y][y] -= inv2m, ma[y][x] += inv2m;
  }

  powmat(n, ma, k, mb);
  mulmatvec(n, mb, va, vb);

  for (int i = 0; i < n; i++) printf("%d\n", vb[i].v);
  return 0;
}

#pragma GCC optimize ("O2")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<iostream>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

ll tmp[600001], *A = tmp + 200000, *B = tmp + 400000;
void pakuri_sort(int N, ll A[]) {
	const int b = 8;
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}
const int CM = 400001, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	if ((tmp & ma0) ^ ma0) {
		int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
		tmp = tmp << dig & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += (72 - dig >> 3);
	}
	else {
		tmp = tmp & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += 8;
		if ((ct = *ci++) >= '0') {
			tmp = tmp * 10 + ct - '0';
			if (*ci++ == '0') {
				tmp = tmp * 10;
				ci++;
			}
		}
	}
	return tmp;
}

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

	int N = getint();
	rep(i, N) {
		A[i] = ll(i) << 32 | getint();
		B[i] = ll(i) << 32 | getint();
	}
	pakuri_sort(N, A);
	pakuri_sort(N, B);

	const ll ma = (1ll << 32) - 1;
	rep(i, N) {
		auto tmp = (A[i] & ma) < (B[N - 1 - i] & ma);
		cn[A[i] >> 31] = tmp;
		cn[B[N - 1 - i] >> 31 | 1] = tmp;
	}

	int c = -1, pn = 0;
	rep(i, N << 1) {
		if (c != -1 && pn == cn[i]) {
			cn[c] = '(';
			cn[i] = ')';
			c = tmp[c];
			pn ^= 1;
		}
		else {
			pn = cn[i];
			tmp[i] = c;
			c = i;
		}
	}
	fwrite(cn, 1, N << 1, stdout);

	Would you please return 0;
}


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

class UnionFind {
public:
    UnionFind(int size) : r(size), p(size)  // 0 origin
    { for (int i = 0; i < size; i++) p[i] = i; }

    int unite(int x, int y) {
        x = find(x), y = find(y);
        if (r[x] > r[y]) swap(x, y);
        else if (r[x] == r[y]) r[y]++;
        return p[x] = y;    // return root
    }

    int find(int x) {
        if (p[x] != x) p[x] = find(p[x]);
        return p[x];
    }

    bool same(int x, int y) { return find(x) == find(y); }
    int rank(int x) const { return r[x]; }
    int parent(int x) const { return p[x]; }
private:
    UnionFind();
    vector<int> r, p;
};

int main() {
    int n, q;
    cin >> n >> q;
    vector<map<int, int>> cnt(n);
    for (int i = 0; i < n; i++) {
        int c;
        scanf("%d", &c);
        cnt[i][c - 1] = 1;
    }
    UnionFind uf(n);
    while (q--) {
        int com, a, b;
        scanf("%d%d%d", &com, &a, &b);
        a--, b--;
        if (com == 1) {
            a = uf.find(a);
            b = uf.find(b);
            if (a == b) continue;
            int root = uf.unite(a, b);
            if (root != a) swap(a, b);
            for (auto [c, v] : cnt[b]) cnt[a][c] += v;
        }
        else printf("%d\n", cnt[uf.find(a)][b]);
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpl;
double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1.0);
#define sqr(x) ((ll)(x) * (x))
#define reset(a,b) memset(a, b, sizeof(a))
#define ff first
#define int long long
#define ss second
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define len(v) (ll)v.size()
#define srt(v) sort( v.begin(), v.end())
#define rsrt(v) sort( v.rbegin(), v.rend())
#define rvrs(v) reverse( v.begin(), v.end())
#define PERMUTE next_permutation
#define tc(t) while (t--)
#define rep(i,x,n) for(int i=x;i<n;i++)
#define ses cout<<"\n"
#define input(x,n) for(int i=0;i<n;i++) cin>>x[i]
#define output(x,n) for(int i=0;i<n;i++) cout<<x[i]<<" "
bool odd(ll n){if(n&1)return true;return false;}
//ll xor(ll a,ll b)return a^b;
ll power(ll x, ll y,ll M){ll res=1;while(y>0){ if(y&1)res=(res*x)%M;y=(y>>1)%M;x=(x*x)%M;}return res;}
constexpr int N = 2e5+5, P = 1000000007;
struct cmp {bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
    int lena = a.second -a.first + 1;int lenb = b.second-b.first + 1;if (lena == lenb) return a.first < b.first;return lena > lenb;
	}
};

bool sortby(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.first<b.first);
}
int gcd(int a,int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int mod=1e9+7;
void code()
{

    int x,y;
    cin>>x>>y;
    if(x==y)
        cout<<x;
    else{
       for(int i=0;i<=2;i++)
       {
           if(i!=x&&i!=y)
            {
                cout<<i;return;
            }
       }
    }
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    tc(t)
    {
       code();ses;
    }
}


//int a = s - '0'; 文字から数字
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//過半数：N/2.0で判定
//優先度付きキュー
//priority_queue<
//ll,
//vector<ll>
//> q;
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
#define PI 3.14159265358979323846264338327950L
using namespace std;

//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

ll RS(ll N, ll P, ll M) {
	if (P == 0) return 1;
	if (P % 2 == 0) {
		ll t = RS(N, P / 2, M);
		return t * t % M;
	}
	return N * RS(N, P - 1, M);
}

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

int main() {
	double a, b, c, d;
	cin >> a >> b >> c >> d;

	long double e = (b + d)/(a - c);
	long double f = b - a * e;

	cout << setprecision(20) << -f/e << endl;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<double,double> ;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i,s1,n) for (ll i=(s1);i<(ll)(n);i++)
#define rrep(i,a,b) for (ll i=(a);i>=(ll)(b);i--)
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define all(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define pb push_back
const ll inf=1LL<<60;
ll min(ll a,ll b) {return a>=b ? b:a;}
ll max(ll a,ll b) {return a>=b ? a:b;}
template<typename T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<typename T>bool chmin(T &a, const T &b) {if (b<a) {a=b; return 1;} return 0;}
const ll mod=1000000007LL;
//const ll mod=998244353LL;

ll b[10000];
ll dp[3009][3009];

int main(){
    ll n;
    cin >> n;
    ll a[n];
    rep(i,n) cin >> a[i];
    rep(i,n) b[i+1]=b[i]+a[i];
    dp[1][0]=1;
    ll ans=0;
    rep2(i,1,n+1){
        rrep(j,n,1){
            dp[j+1][b[i]%(j+1)]+=dp[j][b[i]%j];
            dp[j+1][b[i]%(j+1)]%=mod;
            if (i==n){
                ans+=dp[j][b[i]%j];
                ans%=mod;
            }
        }
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
#include <cstdint>
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; }

const int INF=1001001001;
const int mod = 1000000007;

int main() {
  int N;
  cin>>N;
  vector<int>p(N);
  for(int i=0;i<N;i++){
    cin>>p[i];
  }
  vector<bool>t(200005);
  int s=0;
  for(int i=0;i<N;i++){
    t[p[i]]=true;
    for(int j=s;j<200005;j++){
       if(!t[j]){cout<<j<<endl;s=j;break;}
    }
  }
  return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << (x) << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
template<class T> using prique = priority_queue<T, vector<T>, greater<T>>;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr int mod1e9 = 1000000007;
constexpr int mod998 = 998244353;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; };
int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 };
void fail() { cout << "-1\n"; exit(0); } void no() { cout << "No\n"; exit(0); }
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; }
template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; }

struct fastio {
	fastio() {
		cin.tie(0); cout.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(20);
		cerr << fixed << setprecision(20);
	}
}fastio_;

int main() {
	int n;
	cin >> n;
	set<int> st;
	rep(i, n + 3) st.insert(i);
	rep(i, n) {
		int a;
		cin >> a;
		if (st.count(a)) st.erase(a);
		cout << *st.begin() << '\n';
	}
}


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

ll score(string s){
	vector<ll> cnt(10);
	iota(cnt.begin(), cnt.end(), 0);
	for(char c : s) cnt[c-'0'] *= 10;

	return accumulate(cnt.begin(), cnt.end(), 0);
}

int main(){
	ll k;
	string s,t;
	cin >> k >> s >> t;
	vector<ll> cnt(10,k);
	for(char c : s+t) cnt[c-'0']--;
	ll win = 0;
	for(ll x=1; x<=9; x++){
		for(ll y=1; y<=9; y++){
			s.back() = '0'+x;
			t.back() = '0'+y;
			if(score(s)<=score(t)) continue;
			win += cnt[x]*(cnt[y]-(x==y));
		}
	}

	const ll rem = 9*k-8;
	cout << double(win)/rem/(rem-1) << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll mod = 1000000007;
const double pi = 3.14159265358979;
const ll INF = 1e18;

int main() {
    ll k; cin >> k;
    ll cards = k * 9 - 8;
    string s, t; cin >> s >> t;
    map<char, ll> mps, mpt;
    rep(i, 4) {
        mps[s[i]]++;
        mpt[t[i]]++;
    }
    double ans = 0;
    for (int i = 1; i < 10; i++) {
        if (mps[i + '0'] + mpt[i + '0'] < k) {
            int sprob = k - mps[i + '0'] - mpt[i + '0'];
            mps[i + '0']++;
            ll spoint = 0;
            for (int j = 1; j < 10; j++) {
                spoint += j * pow(10, mps[j + '0']);
            }
            for (int j = 1; j < 10; j++) {
                if (mps[j + '0'] + mpt[j + '0'] < k) {
                    int tprob = k - mps[j + '0'] - mpt[j + '0'];
                    mpt[j + '0']++;
                    ll tpoint = 0;
                    for (int k = 1; k < 10; k++) {
                        tpoint += k * pow(10, mpt[k + '0']);
                    }
                    if (spoint > tpoint) {
                        ans += (double)sprob * tprob / (cards * (cards - 1));
                    }
                    mpt[j + '0']--;
                }
            }
            mps[i + '0']--;
        }
    }
    printf("%.16lf\n", ans);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

int main() {
    ll n;
    string s;
    cin >> n >> s;

    string t = "";
    for(auto c : s) {
        t += c;
        if(t.size() >= 3 && t.substr(t.size() - 3, 3) == "fox") {
            rep(i, 3) {
                t.pop_back();
            }
        }
    }

    out(t.size());
    re0;
}

#include <bits/stdc++.h>
#define INF 1000000007
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef long long int  lli;
typedef long double ld;
typedef vector<int> vi;
typedef unordered_map<int,int> umi ;
typedef unordered_set<int> usi ;
typedef pair<int,int> pi;
#include <bits/stdc++.h>

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

//declare here -------------------------------------------------------------------------------
const int N =4e5+1;
bool taketest=false ;
vi adj[N] ;
bool visited[N] ;
bool visited2[N] ;
bool cycle(int u ,int p){
	if(visited2[u]) return true ;
	visited2[u] =true ;
	bool ans=false ;
	for(auto v:adj[u]){
		if(v==p) continue ;
		ans|= cycle(v,u) ;
	}
	return ans ;
}

int sze(int u ,int p){
	if(visited[u]) return 0 ;
	visited[u] =true ;
	int res=0 ;
	res++ ;
	for(auto v:adj[u]){
		if(v==p) continue ;
		res+= sze(v,u) ;
	}
	return res ;
}

// solve here ---------------------------------------------------------------------------------

void solve(){
	int n ;
	cin>>n ;
	int u,v ;
	REP(i,0,n){
		cin>>u>>v ;
		adj[u].PB(v) ;
		adj[v].PB(u) ;
	}
	int ans=0 ;
	REP(i,0,N){
		if(visited[i]) continue ;
		ans+=sze(i,-1) ;
		if(!cycle(i,-1)) ans-- ;
	}
	cout<<ans ;

}

//--------------------------------------------------------------------------------------------

int main(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long test =1 ;
    if(taketest) cin>>test ;
    while(test--){
        solve() ;
        cout<<"\n" ;
    }
    return 0 ;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;

typedef unsigned int uint;

int main() {
    ll R, C;
    cin >> R >> C;
    vector<vector<ll>> a(R, vector<ll>(C-1));
    for (int i = 0; i < R; ++i) {
        for (int j = 0; j < C - 1; ++j) {
            cin >> a[i][j];
        }
    }
    vector<vector<ll>> b(R-1, vector<ll>(C));
    for (int i = 0; i < R - 1; ++i) {
        for (int j = 0; j < C; ++j) {
            cin >> b[i][j];
        }
    }
    priority_queue<tuple<ll, int, int, int>, vector<tuple<ll, int, int, int>>, greater<>> pq;
    pq.push(make_tuple(0, 0, 0, 0));
    vector<vector<vector<ll>>> dist(2, vector<vector<ll>>(R, vector<ll>(C, -1)));
    while (!pq.empty()) {
        auto [cost, f, r, c] = pq.top(); pq.pop();
        if (dist[f][r][c] != -1) continue;
        dist[f][r][c] = cost;
        if (f == 0 && r == R-1 && c == C-1) break;
        if (f == 0) {
            if (c + 1 < C && dist[0][r][c + 1] == -1) pq.push(make_tuple(cost + a[r][c], 0, r, c + 1));
            if (c - 1 >= 0 && dist[0][r][c - 1] == -1) pq.push(make_tuple(cost + a[r][c - 1], 0, r, c - 1));
            if (r + 1 < R && dist[0][r + 1][c] == -1) pq.push(make_tuple(cost + b[r][c], 0, r + 1, c));
            if (dist[1][r][c] == -1) pq.push(make_tuple(cost + 1, 1, r, c));
        } else {
            if (dist[0][r][c] == -1) pq.push(make_tuple(cost, 0, r, c));
            if (r - 1 >= 0 && dist[1][r - 1][c] == -1) pq.push(make_tuple(cost + 1, 1, r - 1, c));
        }
    }
    cout << dist[0][R-1][C-1] << endl;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type , less<ll> , rb_tree_tag , tree_order_statistics_Node_update>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define inf 1e18
#define mk make_pair
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test ll t; cin>>t; while(t--)
#define setbits __builtin_popcount
#define endl '\n'
#define LOCAL
#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(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define maxn 61
int main()
{
    fastIO;
    vector<vector<ll>>ncr(maxn,vector<ll>(maxn));
    ncr[0][0]=1;
    for(int i=1;i<maxn;i++)
    {
        ncr[i][0]=1;
        for(int j=1;j<i;j++)
        {
            ncr[i][j]=ncr[i-1][j] + ncr[i-1][j-1];
        }
        ncr[i][i]=1;
    }
    ll a,b,k;
    cin>>a>>b>>k;
    string ans;
    ll n=a+b;
    for(int i=0;i<n;i++)
    {
        if(k<=ncr[a+b-1][b])
        {
            ans+='a';
            a--;
        }
        else{
            ans+='b';
            k-=ncr[a+b-1][b];
            b--;
        }
    }
    cout<<ans<<endl;
}

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

ll H, W, A, B;
bool used[MAX_H][MAX_W];

ll dfs(ll i, ll bit, ll a, ll b) {
  if (i == H * W) return 1;
  if (bit & 1 << i) return dfs(i + 1, bit, a, b);
  ll res = 0;
  if (b) res += dfs(i + 1, bit | 1 << i, a, b - 1);
  if (a) {
    if (i % W != W - 1 && ~bit && 1 << (i + 1))
      res += dfs(i + 1, bit | 1 << i | 1 << (i + 1), a - 1, b);
    if (i + W < H * W) res += dfs(i + 1, bit | 1 << i | 1 << (i + W), a - 1, b);
  }
  return res;
}

int main() {
  cin >> H >> W >> A >> B;
  ll res = dfs(0, 0, A, B);
  printf("%lld\n", res);
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#ifdef WA_DEBUG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

using ll  = long long;
using vi  = vector<int>;
using ull = unsigned long long;
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=int(a);i<=(int)(b);i++)
#define per(i,a,b) for(int i=int(a);i>=(int)(b);i--)
const int mod  = 1e9+7;
const int inf  = 0x3f3f3f3f;
const int maxn = 1e5+10;
int main() {
#ifndef WA_DEBUG
    ios::sync_with_stdio(false);cin.tie(nullptr);
#endif
    int n;
    cin>>n;
    string s;
    ll ans=1e10;
    cin>>s;
    if(n==1) {
        if(s[0]=='1') cout<<ans*2<<'\n';
        else cout<<ans<<'\n';
        return 0;
    }
    rep(i,0,2) {
        int now=i;
        bool f=true;
        for(char c:s) {
            char tmp;
            if(now==0) tmp='1';
            if(now==1) tmp='1';
            if(now==2) tmp='0';
            if(tmp!=c) {
                f=false;
                break;
            }
            now=(now+1)%3;
        }
        if(f) {
            int len=i+n;
            len=len/3+(!!(len%3));
            ans=ans-len+1;
            cout<<ans<<'\n';
            return 0;
        }
    }
    cout<<0<<'\n';
    return 0;
}

#include<iostream>
#include<cmath>
using namespace std;
#define ll long long
int main(){
	ll n,ans,N=10000000000;
	char s[200005];
	cin>>n;
	for(ll i=0;i<n;i++){
		cin>>s[i];
	}
	char last='2';
	ll num1=0,num0=0;
	bool flag=0;
	for(ll i=0;i<n;i++){
		if(s[i]=='0'){
			num0++;
			if(num0>1){
				flag=1;
				break;
			}
			if(last=='1'){
				if(num1<2&&i!=1){
					flag=1;
					break;
				}
				num1=0;
			}
		}
		else{
			num1++;
			if(num1>2){
				flag=1;
				break;
			}
			num0=0;
		}
		last=s[i];
		if(flag){
			break;
		}
	}
	if(flag){
		cout<<0;
		return 0;
	}
	if(n==2&&!(s[0]=='0'&&s[1]=='1')){
		cout<<N;
		return 0;
	}
	else if(n==1){
		if(s[0]=='0'){
			cout<<N;
			return 0;
		}
		else{
			cout<<N*2;
			return 0;
		}
	}
	if(s[0]=='0'){
		n-=1;
	}
	else{
		if(s[1]=='0'){
			n-=2;
		}
		else{
			n-=3;
		}
	}
	ans=n/3;
	if(n%3){
		ans++;
	}
	cout<<N-ans;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
char s[500001];
int bb[30];
int vis,numm,ans;
char viss;

signed main()
{
	scanf("%s",s+1);
	viss='!';
	int len=strlen(s+1);
	for(int i=len;i>=3;i--)
	{
		if(s[i-1]==s[i-2]&&s[i]!=s[i-2])
		{
		 	if(s[i-1]!=viss)
		 	{
		 		ans+=(long long)(len-i+1-bb[s[i-1]-'a']);
			}
			else
			{
				ans+=(long long)(vis-i-bb[s[i-1]-'a']);
			}
			//cout<<ans<<endl;
			viss=s[i-1];
		 	vis=i;
			for(int j=0;j<=26;j++) bb[j]=0;
		}
		else
		{
			bb[s[i]-'a']++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define endl "\n"
#define test ll txtc; cin>>txtc; while(txtc--)
typedef long long int ll;
typedef long double ld;
int main() {
    FIO;
    //test
    {
      string s; cin>>s;
      ll n=(ll)s.length();
      vector<vector<ll>>dp(n,vector<ll>(26,0));
      dp[0][s[0]-'a']++;
      for(ll i=1;i<n;i++){
          dp[i][s[i]-'a']++;
          for(ll j=0;j<26;j++){
              dp[i][j]+=dp[i-1][j];
          }
      }
      ll ans=0,last=n,op=-1;
      for(ll i=n-2;i>=1;i--){
          ll ch=s[i]-'a';
          if(s[i]==s[i-1]){
              if(op!=ch){
                  ans+=(n-last);
              }
              //cout<<ans<<endl;
              ans-=(dp[last-1][ch]-dp[i][ch]);
              //cout<<ans<<endl;
              ans+=(last-i-1);
              //cout<<ans<<endl;
              op=ch;
              last=i;
          }
      }
      cout<<ans<<endl;
    }
	return 0;
}


// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

// ModInt begin

using ll = long long;
template<ll mod>
struct ModInt {
    ll v;
    ll mod_pow(ll x, ll n) const {
        return (!n) ? 1 : (mod_pow((x*x)%mod,n/2) * ((n&1)?x:1)) % mod;
    }
    ModInt(ll a = 0) : v((a %= mod) < 0 ? a + mod : a) {}
    ModInt operator+ ( const ModInt& b ) const {
        return (v + b.v >= mod ? ModInt(v + b.v - mod) : ModInt(v + b.v));
    }
    ModInt operator- () const {
        return ModInt(-v);
    }
    ModInt operator- ( const ModInt& b ) const {
        return (v - b.v < 0 ? ModInt(v - b.v + mod) : ModInt(v - b.v));
    }
    ModInt operator* ( const ModInt& b ) const {return (v * b.v) % mod;}
    ModInt operator/ ( const ModInt& b ) const {return (v * mod_pow(b.v, mod-2)) % mod;}

    bool operator== ( const ModInt &b ) const {return v == b.v;}
    bool operator!= ( const ModInt &b ) const {return !(*this == b); }
    ModInt& operator+= ( const ModInt &b ) {
        v += b.v;
        if(v >= mod) v -= mod;
        return *this;
    }
    ModInt& operator-= ( const ModInt &b ) {
        v -= b.v;
        if(v < 0) v += mod;
        return *this;
    }
    ModInt& operator*= ( const ModInt &b ) {
        (v *= b.v) %= mod;
        return *this;
    }
    ModInt& operator/= ( const ModInt &b ) {
        (v *= mod_pow(b.v, mod-2)) %= mod;
        return *this;
    }
    ModInt pow(ll x) { return ModInt(mod_pow(v, x)); }
    // operator int() const { return int(v); }
    // operator long long int() const { return v; }
};

template<ll mod>
ModInt<mod> pow(ModInt<mod> n, ll k) {
    return ModInt<mod>(n.mod_pow(n.v, k));
}

template<ll mod>
ostream& operator<< (ostream& out, ModInt<mod> a) {return out << a.v;}
template<ll mod>
istream& operator>> (istream& in, ModInt<mod>& a) {
    in >> a.v;
    return in;
}

// ModInt end
using mint = ModInt<MOD>;
mint dp[3010][3010], rec[3010][3010];

int main() {
    int N; cin >> N;
    vector<ll> A(N+1);
    for(int i=0; i<N; i++) {
        cin >> A[i+1];
        A[i+1] += A[i];
    }

    dp[0][0] = mint(1);
    for(int i=0; i<N; i++) {
        for(int j=0; j<=i; j++) {
            ll m = A[i] % (j+1);
            rec[j+1][m] += dp[i][j];
        }
        for(int j=0; j<=i; j++) {
            // j+1 番目の区間を作る
            ll m = A[i+1] % (j+1);
            dp[i+1][j+1] += rec[j+1][m];
        }
    }

    mint ans(0);
    for(int j=1; j<=N; j++) {
        ans += dp[N][j];
    }
    cout << ans << endl;
    return 0;
}

/*ver 7*/
#include <bits/stdc++.h>
using namespace std;
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vd = vector<ld>;
using vs = vector<string>;
using vb = vector<bool>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<ld>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
using pll = pair<ll,ll>;
using mll = map<ll,ll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
#define each(x,v) for(auto& x : v)
#define reps(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define mp make_pair
const ll INF = 1LL << 60;
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<=b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define debug cout << "line : " << __LINE__ << " debug" << endl;
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ind(...) long double __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
void in(){}
template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
template <typename T> void in1(T &s) {rep(i,s.size()){in(s[i]);}}
template <typename T> void in2(T &s,T &t) {rep(i,s.size()){in(s[i],t[i]);}}
template <typename T> void in3(T &s,T &t,T &u) {rep(i,s.size()){in(s[i],t[i],u[i]);}}
template <typename T> void in4(T &s,T &t,T &u,T &v) {rep(i,s.size()){in(s[i],t[i],u[i],v[i]);}}
template <typename T> void in5(T &s,T &t,T &u,T &v,T &w) {rep(i,s.size()){in(s[i],t[i],u[i],v[i],w[i]);}}
void out(){cout << endl;}
template <typename T,class... U> void out(const T &t,const U &...u){cout << t; if(sizeof...(u)) cout << " "; out(u...);}
void die(){cout << endl;exit(0);}
template <typename T,class... U> void die(const T &t,const U &...u){cout << t; if(sizeof...(u)) cout << " "; die(u...);}
template <typename T> void outv(T s) {rep(i,s.size()){if(i!=0)cout<<" ";cout<<s[i];}cout<<endl;}
template <typename T> void out1(T s) {rep(i,s.size()){out(s[i]);}}
template <typename T> void out2(T s,T t) {rep(i,s.size()){out(s[i],t[i]);}}
template <typename T> void out3(T s,T t,T u) {rep(i,s.size()){out(s[i],t[i],u[i]);}}
template <typename T> void out4(T s,T t,T u,T v) {rep(i,s.size()){out(s[i],t[i],u[i],v[i]);}}
template <typename T> void out5(T s,T t,T u,T v,T w) {rep(i,s.size()){out(s[i],t[i],u[i],v[i],w[i]);}}
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
template <typename T> T allSum(vector<T> a){T ans=T();each(it,a)ans+=it;return ans;}
ll ceilDiv(ll a,ll b) {return (a+b-1)/b;}
ld dist(pair<ld,ld> a, pair<ld,ld> b){return sqrt(abs(a.fi-b.fi)*abs(a.fi-b.fi)+abs(a.se-b.se)*abs(a.se-b.se));} // ２点間の距離
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b;}
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
#define YES(n) ((n) ? "YES" : "NO"  )
#define Yes(n) ((n) ? "Yes" : "No"  )
#define yes(n) ((n) ? "yes" : "no"  )

int main(){
    init();
    inl(n);
    ld ans=0;
    reps(i,1,n+1){
        ans+=(ld)1/i;
    }
    out(ans*n-1);
    return 0;
}


#include <bits/stdc++.h>

// clang-format off
using namespace std;
class Rep{struct I{int i;void operator++(){++i;}int operator*(){return i;}bool operator!=(I o){return i<*o;}}b,e;
public:Rep(int l,int r):b{l},e{r}{}Rep(int n):Rep(0,n){}I begin(){return b;}I end(){return e;}};
class Per{struct I{int i;void operator++(){--i;}int operator*(){return i;}bool operator!=(I o){return i>*o;}}b,e;
public:Per(int l,int r):b{r-1},e{l-1}{}Per(int n):Per(0,n){}I begin(){return b;}I end(){return e;}};
template<class F>struct Fix:F{Fix(F f):F(f){}
template<class...T>decltype(auto)operator()(T&&...a){return F::operator()(*this,forward<T>(a)...);}};
template<class T=int>T scan(){T r;cin>>r;return r;}
template<class T,class U=T>bool chmin(T&a,U&&b){return b<a?a=forward<U>(b),1:0;}
template<class T,class U=T>bool chmax(T&a,U&&b){return a<b?a=forward<U>(b),1:0;}
#ifndef LOCAL
#define DUMP(...) void(0)
#endif
#define ALL(c) begin(c), end(c)
// clang-format on

main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  auto s = scan<string>();
  int ans = 0;
  for (int i : Rep(10000)) {
    vector<bool> exists(10);
    for (int _ = 4; _--;) {
      exists[i % 10] = true;
      i /= 10;
    }
    ans += [&]() -> bool {
      for (int x : Rep(10)) {
        if (s[x] == 'o' and not exists[x]) return false;
        if (s[x] == 'x' and exists[x]) return false;
      }
      return true;
    }();
  }
  cout << ans << '\n';
}

#include <iostream>
#include <string>
#include <set>
#include <map>
using namespace std;

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

  int r = 0;

  map<int, int> c;

  int d[10] = {};

  for (int i = 0; i < 10; i++)
  {
    if (s[i] == 'o')
    {
      c[i] = 1;
      d[i] = 1;
      r++;
    }
    else if (s[i] == '?')
    {
      d[i] = 1;
    }
  }

  if (c.size() > 4)
  {
    cout << 0;
    return 0;
  }

  int sum = 0;

  for (int i = 0; i < 10; i++)
  {
    for (int j = 0; j < 10; j++)
    {
      for (int k = 0; k < 10; k++)
      {
        for (int h = 0; h < 10; h++)
        {
          int temp = 0;
          if (c[i])
            temp++;
          if (i != j && c[j])
            temp++;
          if (k != j && k != i && c[k])
            temp++;
          if (h != i && h != j && h != k && c[h])
            temp++;

          if (temp == r)
          {
            if (d[i] + d[j] + d[k] + d[h] == 4)
            {
              sum++;
            }
          }
        }
      }
    }
  }

  cout << sum << endl;
}


#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#define MY_IS_DEBUG      (true)
#else
#define MY_NAMESPACE(ns)
#define MY_NAMESPACE_
#define MY_DEBUG(s)
#define MY_IS_DEBUG      (false)
#endif

#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

constexpr int IMIN = numeric_limits<int>::min();
constexpr int IMAX = numeric_limits<int>::max();
constexpr ll LLMIN = numeric_limits<ll>::min();
constexpr ll LLMAX = numeric_limits<ll>::max();

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define fore(i, a) for (auto& i: a)
#define all(x) (x).begin(), (x).end()

template <typename T> bool chmax(T& maxval, T const& newval) { if (newval > maxval) { maxval = newval; return true; } return false; }
template <typename T> bool chmin(T& minval, T const& newval) { if (newval < minval) { minval = newval; return true; } return false; }

MY_NAMESPACE(testbed)
int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n, m;
	cin >> n >> m;
	vector<vector<tuple<int, ll, ll, ll>>> e(n);
	rep(i, 0, m)
	{
		int a, b;
		ll c, d;
		cin >> a >> b >> c >> d;
		a--;
		b--;
		ll opt = (d == 0 ? 0LL : (ll)exp(-1.0 / (double)d));
		e[a].push_back({ b, c, d, opt });
		e[b].push_back({ a, c, d, opt });
	}

	auto priority_fn = [](pil const& lhs, pil const& rhs)->bool  // return true to prioritize rhs
	{
		return (rhs.second < lhs.second);
	};

	vector<ll> min_time(n, LLMAX);
	priority_queue<pil, vector<pil>, decltype(priority_fn)> q(priority_fn);
	q.push({ 0, 0 });
	min_time[0] = 0;
	while (!q.empty())
	{
		int this_city;
		ll this_time;
		tie(this_city, this_time) = q.top();
		q.pop();

		if (this_time > min_time[this_city])
			continue;

		fore(tpl, e[this_city])
		{
			int next_city = get<0>(tpl);
			ll cval = get<1>(tpl);
			ll dval = get<2>(tpl);
			ll optval = get<3>(tpl);

			ll next_time = this_time;
			if (dval == 0)
			{
				next_time += cval;
			}
			else
			{
				ll min_move = LLMAX;
				ll wait_time = max((ll)sqrt((double)dval) - 1LL - this_time, 0LL);
				for (ll adj = -100; adj <= 100; adj++)
				{
					ll this_wait_time = max(wait_time + adj, 0LL);
					ll this_move = this_wait_time + cval + dval / (this_time + this_wait_time + 1LL);
					chmin(min_move, this_move);
				}
				next_time += min_move;
			}
			if (chmin(min_time[next_city], next_time))
			{
				q.push({ next_city, next_time });
			}
		}
	}

	ll ans = min_time[n - 1];
	if (ans == LLMAX)
		ans = -1;
	cout << ans << "\n";
	return 0;
}
MY_NAMESPACE_

#include <bits/stdc++.h>
// #include <atcoder/modint>
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define INF 2000000000000000000
#define ll long long
#define ld long double
#define pll pair<ll, ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

struct edge {ll to, c, d, index;};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M;
  cin >> N >> M;
  vector<vector<edge>> connection(N);
  map<ll, ll> mp;
  for (ll i = 0; i < M; ++i) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    a -= 1, b -= 1;
    connection.at(a).push_back({b, c, d, i});
    connection.at(b).push_back({a, c, d, i});
    ld l = 0, r = d;
    while (l + 0.01 < r) {
      ld m1 = (l * 2 + r) / 3.0;
      ld m2 = (l + r * 2) / 3.0;
      ld c1 = m1 + (d / (m1 + 1));
      ld c2 = m2 + (d / (m2 + 1));
      if (c1 < c2) {
        r = m2;
      }
      else {
        l = m1;
      }
    }
    ll l1 = floor(l), l2 = ceil(l);
    ll l0 = l1;
    if (l1 + d / (l1 + 1) > l2 + d / (l2 + 1)) {
      l0 = l2;
    }
    mp[i] = max(0ll, l0);
  }
  vector<ll> dist(N, INF);
  dist.at(0) = 0;
  typedef pair<ll, ll> P;// first は最短距離　second は頂点の番号
  priority_queue<P, vector<P>, greater<P>> q;
  q.push({0, 0});
  while (!q.empty()) {
    ll now = q.top().second;
    ll now_dist = q.top().first;
    q.pop();
    if (dist.at(now) < now_dist) continue;
    for (ll i = 0; i < connection.at(now).size(); ++i) {
      edge e = connection.at(now).at(i);
      ll next = e.to, c = e.c, d = e.d, index = e.index;
      if (dist.at(next) <= dist.at(now) + c) {
        continue;
      }
      ll temp = mp[index];
      // cout << temp << "\n";
      if (dist.at(now) >= temp) {
        if (dist.at(next) > dist.at(now) + c + d / (dist.at(now) + 1)) {
          chmin(dist.at(next), dist.at(now) + c + d / (dist.at(now) + 1));
          q.push({dist.at(next), next});
        }
      }
      else {
        if (dist.at(next) > temp + c + d / (temp + 1)) {
          chmin(dist.at(next), temp + c + d / (temp + 1));
          q.push({dist.at(next), next});
        }
      }
    }
  }
  if (dist.at(N - 1) == INF) {
    cout << -1 << "\n";
  }
  else {
    cout << dist.at(N - 1) << "\n";
  }
}


#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

double f(double w, double t, double c, double d) {
  return t + w + c + (d / (t + w + 1.0));
}

int64_t get_wait(int64_t time, int64_t c, int64_t d) {
  double low = 0;
  double high = 1e9;
  int cnt = 64;
  while (cnt--) {
    double c1 = (low * 2 + high) / 3;
    double c2 = (low + high * 2) / 3;
    if (f(c1, time, c, d) > f(c2, time, c, d))
      low = c1;
    else
      high = c2;
  }
  return ceil(low);
}

int main(void) {
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  using gtype = tuple<int64_t, int64_t, int64_t>;
  vector<vector<gtype>> G(N);
  rep(i, M) {
    int A, B;
    int64_t C, D;
    cin >> A >> B >> C >> D;
    A--, B--;
    G[A].emplace_back(B, C, D);
    G[B].emplace_back(A, C, D);
  }

  using qtype = tuple<int64_t, int64_t>;
  priority_queue<qtype, vector<qtype>, greater<qtype>> que;
  que.emplace(0, 0);
  vector<int64_t> visit(N, INT64_MAX / 2);
  visit[0] = 0;
  while (!que.empty()) {
    auto [time, u] = que.top();
    que.pop();
    if (u == N - 1) {
      cout << time << endl;
      return 0;
    }
    if (visit[u] < time) continue;

    for (const auto& [v, c, d] : G[u]) {
      int64_t wait = get_wait(time, c, d);
      int64_t ntime = time + wait + c + d / (time + wait + 1);
      if (ntime < visit[v]) {
        visit[v] = ntime;
        que.emplace(ntime, v);
      }
    }
  }
  cout << -1 << endl;
  return 0;
}

#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;

struct UnionFind {
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }
};

int main() {
  int n,m;
  cin >> n >> m;
  ll a[n],b[n];
  rep(i,n)cin >> a[i];
  rep(i,n)cin >> b[i];

  UnionFind tree(n);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--,b--;
    tree.unite(a,b);
  }

  ll ansa[n]={},ansb[n]={};
  rep(i,n){
    ll ak=a[i],bk=b[i];
    a[i]=0,b[i]=0;
    ansa[tree.root(i)]+=ak;
    ansb[tree.root(i)]+=bk;
  }
  //rep(i,n)cout << ansa[i] << " " << ansb[i] << " " << tree.root(i) << endl;
  rep(i,n)if(ansa[tree.root(i)]!=ansb[tree.root(i)]){cout << "No" << endl; return 0;}
  cout << "Yes" << endl;

}


#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a; i<b; i++)
#define fr(i,a,b) for(int i=a; i>=b; i--)
#define fll(i,a,b) for(ll i=a; i<b; i++)
#define frll(i,a,b) for(ll i=a; i>=b; i--)
typedef vector<int> vi;
typedef long long int ll;
typedef vector<ll> vll;
#define fastio std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PI 3.1415926535
ll Mod = 1e9+7;
ll N = 1e5;

// ll Mod = 998244353;

// ll mult(ll a, ll b, ll mod = Mod) {
//     ll ret = 1;
//     ret = ((a%mod) * (b%mod))%mod;
//     return ret;
// }

// ll pow(ll a, ll b, ll mod = Mod-2) {
//     if(b == 0) return 1;
//     ll ret = 1;
//     while(b) {
//         if(b&1) {
//             ret = mult(ret,a,mod);
//         }
//         a = mult(a,a,mod);
//         b>>=1;
//     }
//     return ret;
// }

// ll sub(ll a, ll b) {
//     ll ret = (a%Mod - b%Mod + Mod)%Mod;
//     return ret;
// }

// void seive(vector<bool> &status) {
//      f(i,2,2e6+1) {
//          if(status[i]) {
//                 for(ll j = i*i; j<=2e6; j+=i) status[j] = 0;
//          }
//      }
//  }

// int getmex(vi& occr, int n, int mex) {
//     for(int i = mex; i<n; i++) {
//         if(occr[i] == 0) return i;
//     }
//     return n;
// }

// void swap(int &a, int &b) {
//     a = a + b;
//     b = a - b;
//     a = a - b;
// }

// int gcd(int a, int b) {
//     if(b == 0) return a;
//     return gcd(b,a%b);
// }

void test_case() {
    int n,u,v;
    ll w;
    cin>>n;
    vector<vector<int>> tree(n+1);
    vector<vector<ll>> wt(n+1);
    f(i,0,n-1) {
        cin>>u>>v>>w;
        tree[v].push_back(u);
        tree[u].push_back(v);
        wt[v].push_back(w);
        wt[u].push_back(w);
    }

    queue<int> q;
    q.push(1);
    ll dist[n+1];
    memset(dist, -1, sizeof dist);
    dist[1] = 0;
    while(!q.empty()) {
        int p = q.front();
        q.pop();
        f(i,0,tree[p].size()) {
            int x = tree[p][i];
            ll w = wt[p][i];
            if(dist[x] == -1) {
                dist[x] = dist[p]^w;
                q.push(x);
            }
        }
    }

    ll ans = 0;
    f(i,0,60) {
        ll up = 0, lo = 0;
        f(j,1,n+1) {
            if((dist[j]>>i)&1) up++;
            else lo++;
        }
        ans = (ans + ((1LL<<i)%Mod*((up*lo)%Mod))%Mod)%Mod;
    }

    cout<<ans<<'\n';

}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    fastio;
    // vector<bool> status(2e6+1,1);
    int t = 1;
    // vi primes;
    // seive(status);
    // f(i,2, 2e6+1) {
    //     if(i > 5000) {
    //         break;
    //     }
    //     if(status[i]) primes.push_back(i);
    // }
    // cin>>t;

    while(t--) {
        test_case();
    }

}

#include <bits/stdc++.h>
using namespace std;
#define io ios_base::sync_with_stdio(false); cin.tie(nullptr);
#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(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }
#define int long long

const int nax = 200001;
vector<int> graph[nax];
vector<int> weight[nax];

int32_t main() {
	int n;
	scanf("%lld", &n);
	for(int i = 0; i < n - 1; ++i){
		int u, v, w;
		scanf("%lld %lld %lld", &u, &v, &w);
		graph[u].push_back(v);
		graph[v].push_back(u);
		weight[u].push_back(w);
		weight[v].push_back(w);
	}
	int dist_from_root[n + 1] = {0};
	function<void(int, int, int)> dfs = [&] (int vertex, int parent, int curr){
		dist_from_root[vertex] = curr;
		for(int i = 0; i < (int)graph[vertex].size(); ++i){
			int child = graph[vertex][i];
			int node_weight = weight[vertex][i];
			if(child == parent)
				continue;
			dfs(child, vertex, curr^node_weight);
		}
	};
	dfs(1, 0, 0);
	int track_bits[60] = {0};
	for(int i = 1; i <= n; ++i){
		for(int j = 0; j < 60; ++j){
			if((dist_from_root[i] & (1ll << j))) ++track_bits[j];
		}
	}
	int ans = 0;
	int MOD = 1e9 + 7;
	for(int i = 0; i < 60; ++i){
		int value = ((track_bits[i] % MOD) * ((n - track_bits[i]) % MOD)) % MOD * ((1ll << i) % MOD);
		value = value % MOD;
		ans = ans + value;
		ans = (ans + MOD) % MOD;
	}
	printf("%lld\n", ans);
	return 0;
}


// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include <iostream>
#include <bitset>
#include <algorithm>        // sort()
#include <vector>           // for vectors
#include <map>              // for ordered map
#include <unordered_map>
#include <list>             // for list
#include <iomanip>          // for setprecision()
#include <cmath>            // for pow(), sqrt(), log(), log10(), ....
#include <cstring>          // for memset()
#include <unordered_set>    // for unordered_set
#include <climits>          // for INT_MAX & INT_MIN
#include <set>              // for ordered set

#define C ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
#define INF INT_MAX
#define NINF INT_MIN
#define MOD 1000000007
const double pi=acos(-1); // value of pi

bool isVowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') {
        return 1;
    }
    return 0;
}

bool compare(pair<ll, ll> a, pair<ll, ll> b) {
    return a.second<b.second;
}

bool isPrime(ll n) {
    if(n%2==0 && n!=2) {
        return false;
    }
    for(ll i=3; i*i<=n; i+=2) {
        if(n%i==0) {
            return false;
        }
    }
    return true;
}

ll binary_exp(ll x, ll n, ll mod)
{
    if (n == 0) {
        return 1;
    } else if (n == 1) {
        return x % mod;
    } else {
        ll temp = binary_exp(x, n / 2, mod);
        temp = (temp * temp) % mod;

        if (n % 2 == 0) {
            return temp;
        } else {
            return ((x % mod) * temp) % mod;
        }
    }
}

map<ll, ll> a, b;
// map<ll, ll> m;

int main() {
    C
//     freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
    int t=1;
    // cin >> t;
    while(t--) {
        ll n, a, b;
        cin >> n >> a >> b;
        cout << n-a+b << endl;
    }
}


#pragma GCC optimize ("O2")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<iostream>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

ll tmp[600001], *A = tmp + 200000, *B = tmp + 400000;
void pakuri_sort(int N, ll A[]) {
	const int b = 8;
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}
const int CM = 400001, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	if ((tmp & ma0) ^ ma0) {
		int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
		tmp = tmp << dig & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += (72 - dig >> 3);
	}
	else {
		tmp = tmp & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += 8;
		if ((ct = *ci++) >= '0') {
			tmp = tmp * 10 + ct - '0';
			if (*ci++ == '0') {
				tmp = tmp * 10;
				ci++;
			}
		}
	}
	return tmp;
}

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

	int N = getint();
	rep(i, N) {
		A[i] = ll(i) << 32 | getint();
		B[i] = ll(i) << 32 | getint();
	}
	pakuri_sort(N, A);
	pakuri_sort(N, B);

	const ll ma = (1ll << 32) - 1;
	rep(i, N) {
		auto tmp = (A[i] & ma) < (B[N - 1 - i] & ma);
		cn[A[i] >> 31] = tmp;
		cn[B[N - 1 - i] >> 31 | 1] = tmp;
	}

	int c = -1, pn = 0;
	rep(i, N << 1) {
		if (c != -1 && pn == cn[i]) {
			cn[c] = '(';
			cn[i] = ')';
			c = tmp[c];
			pn ^= 1;
		}
		else {
			pn = cn[i];
			tmp[i] = c;
			c = i;
		}
	}
	fwrite(cn, 1, N << 1, stdout);

	Would you please return 0;
}

/*@author : ashnove*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define lld long double
#define F first
#define S second
#define endl "\n"
#define nl cout<<endl;
#define pb push_back
#define f(i,a,b) for(ll i=a;i<b;i++)
#define what_is(x) cerr << #x << " is " << x << endl;
#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;}
bool sortmahstyle(const pair<ll, pair<ll,ll>> &a,  const pair<ll, pair<ll,ll>> &b){
    if(a.first > b.first ) return 1;
    if( a.first==b.first && a.S.S > b.S.S ) return 1;
    return 0;
}

ll const mod = 1e9+7;
ll const inf = 1e18;
ll const maxn = 2e5+1;
class edge{
public:
      ll a,b,w;
};

vector<edge> adj;

void solve()
{
      ll n,x; cin >> n >> x;
      ll a[n];
      for(ll i = 0; i < n; i++)
            cin >> a[i];

      ll dp[n][n+1][n];
      f(i,0,n)f(j,0,n+1)f(k,0,n) dp[i][j][k] = -1;
      f(i,0,n) dp[i][0][0] = 0;

      for(ll i = 0; i < n; i++){

            for(ll j = 0; j < n; j++){

                  for(ll cnt = i+1; cnt>0; cnt--){

                        for(ll rem = 0; rem <= i; rem++){

                              if(dp[i][cnt-1][rem]!=-1){
                                    ll sum = dp[i][cnt-1][rem] + a[j];
                                    dp[i][cnt][ sum%(i+1) ] = max(dp[i][cnt][ sum%(i+1) ] , sum);
                              }

                        }

                  }

            }

      }

      ll res = x;
      for(ll i = 0; i < n; i++){

            if(dp[i][i+1][ x % (i+1) ] != -1)
                  res = min(res, (x - dp[i][i+1][ x % (i+1) ])/(i+1));
      }
      cout << res << endl;
}

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
//*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/
            ll t;
            /**/t=1;
            /*/cin>>t;/**/
            f(testcases,0,t){
               //cout << "Case #" <<testcases+1<<": ";
               solve();
            }
      // printf("TIME: %.3lf\n", double(clock()) / CLOCKS_PER_SEC);
      return 0;
}


#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template <typename T, typename V>
void ndarray(vector<T>& vec, const V& val, int len) { vec.assign(len, val); }
template <typename T, typename V, typename... Args> void ndarray(vector<T>& vec, const V& val, int len, Args... args) { vec.resize(len), for_each(begin(vec), end(vec), [&](T& v) { ndarray(v, val, args...); }); }
template <typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template <typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template <typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template <typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
template <typename T> vector<T> srtunq(vector<T> vec) { sort(vec.begin(), vec.end()), vec.erase(unique(vec.begin(), vec.end()), vec.end()); return vec; }
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { os << '['; for (auto v : vec) os << v << ','; os << ']'; return os; }
#if __cplusplus >= 201703L
template <typename... T> istream &operator>>(istream &is, tuple<T...> &tpl) { std::apply([&is](auto &&... args) { ((is >> args), ...);}, tpl); return is; }
template <typename... T> ostream &operator<<(ostream &os, const tuple<T...> &tpl) { std::apply([&os](auto &&... args) { ((os << args << ','), ...);}, tpl); return os; }
#endif
template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) { os << "deq["; for (auto v : vec) os << v << ','; os << ']'; return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T, typename TH> ostream &operator<<(ostream &os, const unordered_set<T, TH> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa) { os << '(' << pa.first << ',' << pa.second << ')'; return os; }
template <typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp) { os << '{'; for (auto v : mp) os << v.first << "=>" << v.second << ','; os << '}'; return os; }
template <typename TK, typename TV, typename TH> ostream &operator<<(ostream &os, const unordered_map<TK, TV, TH> &mp) { os << '{'; for (auto v : mp) os << v.first << "=>" << v.second << ','; os << '}'; return os; }
#ifdef HITONANODE_LOCAL
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl
#else
#define dbg(x) {}
#endif

int main()
{
    int N;
    cin >> N;
    lint ret = 0;
    while (N--) {
        lint a, b;
        cin >> a >> b;
        ret += (b + a) * (b - a + 1) / 2;
    }
    cout << ret << '\n';
}

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

#define INF (int)1e9
#define eps (int)1e-9
#define ll long long
#define ld long double
#define FOR(i,m,n) for(int i=m; i<n; i++)
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

void solve(){
    ld n; cin >> n;
    vt<ld> a(n);
    vt<ld> b(n);
    ld sum=0;
    FOR(i,0,n){
        cin >> a[i];
        cin >> b[i];
    }
    FOR(i,0,n){
        ld diff = b[i]-a[i]+1;
        sum += b[i]*diff - (diff-1)*(diff)/2;
    }
    cout << setprecision(30) << sum << endl;
}

int main(){
    int tt;
    //cin >> tt;
    tt=1;
    while (tt--){
        solve();
    }
}


/**
 *    author:     stein
 *    created:    2020.12.19 14:59:32
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, W;
  cin >> N >> W;
  cout << N / W << '\n';
  return 0;
}

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define indexed_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ook order_of_key
#define fbo find_by_order
#define ll long long
ll md=998244353;
#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define pb push_back
#define g(v,i,j) get<i>(v[j])
#define vi vector<int>
#define vll vector<ll>
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.begin(),v.end(),greater<int>())
#define fi(i,a,b) for(int i=a;i<b;i++)
#define fll(i,a,b) for(ll i=a;i<b;i++)
using namespace std;
using namespace std::chrono;
template<typename T>
T pw(T a, T b)
{
    T c=1,m=a;
    while (b){
        if(b&1) c=(c * m);
        m=(m*m),b/=2;
    }
    return c;
}
template<typename T>
T ceel(T a,T b)
{
    if(a%b==0) return a/b;
    else return a/b+1;
}
template<typename T>
T my_log(T n, T b)
{
    T i=1,ans=0;
    while(1){
        if(i>n){
            ans--;
            break;
        }
        if(i==n) break;
        i*=b,ans++;
    }
    return ans;
}
template<typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
template<typename T>
T mysqt(T a)
{
    T ans=1;
    while(ans*ans<=a) ans++;
    ans--;
    return ans;
}
ll pwmd(ll a,ll b)
{
    ll c=1,m=a;
    while(b){
        if(b&1) c=(c*m)%md;
        m=(m*m)%md;
        b/=2;
    }
    return c;
}
ll modinv(ll n)
{
    return pwmd(n, md - 2);
}
ll inverse(ll i){
    if(i==1) return 1;
    return (md - ((md/i)*inverse(md%i))%md+md)%md;
}
bool sortbysec(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}
   /* auto start = high_resolution_clock::now();
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
    cerr << "Time taken: "
         << duration.count()<< "ms" <<"\n";*/
vector<char> capl={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char> sml={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
template<typename T>
string conv(T a)
{
    string b;
    T e=2;
    T c=my_log(a,e);
    c++,b='1';
    for(T i=0;i<c-1;i++){
        T k=a>>(c-2-i);
        if(k&1) b+='1';
        else b+='0';
    }
    if(a==0) return "0";
    return b;
}
int main()
{
    fast;
    int n,w;
    cin>>n>>w;
    cout<<n/w;
}


#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<char> Vc;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<char>> VVc;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define endl '\n'
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgset(st) cerr << #st << ":"<<endl; for (auto i = st.begin(); i != st.end(); ++i) { cerr << *i <<" ";}cerr<<endl;
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#else
#define dbg(...)
#define dbgmap(...)
#define dbgset(...)
#define dbgarr(...)
#define dbgdp(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    s<<endl;
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    string s;
    cin>>s;
    ll ok = 1;
    auto is_upper = [](char c)->bool{
        return toupper(c) == c;
    };
    auto is_lower = [](char c)->bool{
        return tolower(c) == c;
    };
    ll n = s.length();
    string S;
    rep(i,n){
        if(i%2==0){
            if(!is_lower(s[i])){
                ok = 0;
            }
            S += tolower(s[i]);
        }else{
            if(!is_upper(s[i])){
                ok = 0;
            }
            S += toupper(s[i]);
        }
    }
    dbg(s)
    dbg(S)
    Yes(ok);
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
//    ll T;
//    cin>>T;
//    while(T--)
    solve();
}

#include<bits/stdc++.h>
using namespace std;
const int maxn=102;
vector<int> g[maxn];
bool vis[maxn];
int n;
string s[maxn];
int dfs(int s,int p)
{
    int res=1;
    if(vis[s])
    return 0;
    vis[s]=1;
    for(auto it:g[s])
    if(it!=p)
    res+=dfs(it,s);
    return res;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>s[i];
    for(int i=0;i<n;i++)
    for(int j=0;j<s[i].size();j++)
    if(s[i][j]=='1')
    g[j].push_back(i);
    double res=0.0;
    for(int i=0;i<n;i++)
    {
        memset(vis,0,sizeof(vis));
        res+=1.0/dfs(i,i);
    }
    cout<<fixed<<setprecision(10)<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mxN = 1+1000*100;
#define int long long
const int mod = 1e9+7;

signed main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	vector<char> v;
	for(int i = 0 ;i<n;i++)
	{
		v.push_back(s[i]);
		if(v.size()>=3)
		{
			int sz = v.size();
			if(v[sz-1]=='x' && v[sz-2]=='o' && v[sz-3]=='f')
			{
				v.pop_back();
				v.pop_back();
				v.pop_back();
			}
		}
	}
	cout<<v.size();
}

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

int main() {

  int N, K;
  cin >> N >> K;

  vector<int> count(N+10);
  int a;
  for (int i = 0; i < N; i++) {
    cin >> a;
    count[a]++;
  }

  count[0] = min(count[0],K);

  int sum = 0;
  for (int i = 1; i < N+10; i++) {
    if (count[i-1] <= count[i]) {
      count[i] = count[i-1];
    }
    else {
      sum += (count[i-1]-count[i])*i;
    }

    if (count[i] == 0) {
      break;
    }
  }

  cout << sum << endl;

return 0;
}


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

int main(){
    string s;
    cin >> s;
    deque<char> t;
    string ans;
    bool h = false;
    rep(i, s.size()){
        if (s[i] == 'R') h = !h;
        else{
            if (!h) t.push_back(s[i]);
            else t.push_front(s[i]);
        }
    }

    if (h){
        reverse(t.begin(), t.end());
    }

    for (char c : t){
        if (ans.size() && ans.back() == c) ans.pop_back();
        else ans.push_back(c);
    }
    cout << ans << endl;
}

	// Author :: <Hitesh_Saini>
	#include<bits/stdc++.h>

	#define __speed() ios_base::sync_with_stdio(false), cin.tie(nullptr);
	#define dbg(x) cout << "(" << __LINE__ << ": "<< #x << " = " << x << ")\n"

	#define Yes(x) puts((x) ? "Yes" : "No")
	#define tt 	int t; for (cin >> t; t--; )

	#define f0(i, n)  for (i = 0; i < (int)(n); i++)
	#define f1(i, n)  for (i = 1; i <=(int)(n); i++)

	#define all(x) x.begin(), x.end()
	#define rall(x) x.rbegin(), x.rend()
	#define sz(x) (int)(x.size())

	#define EB emplace_back
	#define PB push_back

	#define LB lower_bound
	#define UB upper_bound

	#define endl "\n"
	#define S second
	#define F first

	using namespace std;
	using mii = map<int, int>;
	using pii = pair<int, int>;

	using ll = int64_t;
	using vi = vector<int>;

	using vvi = vector<vi>;
	using vl = vector<ll>;

	const pair<int, int> DD[] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
	const int mod = 1e9 + 7, mxN = 2e5 + 5, INF = 0x3f3f3f3f;
	const ll LINF = 0x3f3f3f3f3f3f3f3f;

	template <typename... T> void print(T... args) { ((cout << args << " "), ...), cout << endl; }

	template <typename T1, typename T2> bool cmax(T1& a, T2 b) { if (b > a) { a = b; return true; } return false; }
	template <typename T1, typename T2> bool cmin(T1& a, T2 b) { if (b < a) { a = b; return true; } return false; }

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

	void solve() {
		int n, d, h, i, j;
		string s;
		cin >> s;
		n = sz(s);
		deque<char> ans;
		int x = 1;
		for (char z : s) {
			if (z == 'R')
				x ^= 1;
			else {
				if (x) {
					if (sz(ans) && ans.back() == z)
						ans.pop_back();
					else
						ans.push_back(z);
				} else {
					if (sz(ans) && ans.front() == z)
						ans.pop_front();
					else
						ans.push_front(z);
				}
			}
		}
		// ans.erase(unique(all(ans)), ans.end());
		if (!x) reverse(all(ans));
		for (char x : ans) cout << x;
	}

	signed main() {
		cout << fixed << setprecision(12);

		__speed() solve();
		 // int t, i; for (cin >> t, i = 1; i <= t; i++) cout << "Case #" << i << ": ", solve();
	}


#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include <stack>
#include <random>
#include <iomanip>

#include <fstream>

using namespace std;
typedef long long ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main(){fastio
    ll a[4];rep(i,0,3)cin>>a[i];
    cout<<a[0]*a[3]-a[1]*a[2]<<endl;

    return 0;
}

/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 61;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[201][12];

void cmemoInit(){
    rep(i, 201){
        rep(j, 12){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n;
    cin >> n;
    cout << n - 1 << endl;
}


#include<iostream>
#include<unordered_set>

using namespace std;

int main(){
    int N;
    cin >> N;
    string str;
    string ss[N];

    unordered_set<string> s;
    for(int i=0; i<N; i++){
        cin >> str;
        s.insert(str);
        ss[i] = str;
    }
    for(int i=0; i<N; i++){
        string ch = "!" + ss[i];
        if(s.find(ch)!=s.end()){
            cout << ss[i] << endl;
            return 0;
        }
    }
    cout << "satisfiable" << endl;
}

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

int main(){
  int N,S,D;
  cin >> N >> S >> D;
  int X,Y;
  rep(i,N){
    cin >> X >> Y;
    if(X<S && Y>D){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}