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

int main()
{
  long double n;
  cin >> n;

  long double a, b, ansA = -1, ansB = -1;
  for (long double i = 1;; i++) {
    a = powl(3, i);
    if (a > n) break;
    for (long double j = 1;; j++) {
      b = powl(5, j);
      if (b > n) break;
      if (a + b  == n) {
        ansA = i;
        ansB = j;
        break;
      }
    }
  }

  if (ansA == -1) {
    cout << -1 << endl;
  } else {
    cout << ansA << " " << ansB << endl;
  }
}

#include <bits/stdc++.h>
#include<random>
using namespace std; typedef unsigned long long _ulong; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint 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)
#define endk '\n'
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; }
const lint MOD = 1e9 + 7, INF = 1e18;
lint dx[8] = { 0, -1, 1, 0, 1, -1, 1, -1 }, dy[8] = { 1, 0, 0, -1, -1, -1, 1, 1 };
typedef pair<long double, lint> Pa;
typedef pair<lint, plint> tlint;
struct edge {
	lint cost;
	lint u, v;
};

lint N;
int main() {
	cin >> N;
	lint cnt3 = 1;
	lint curr = 3;
	while (true) {
		lint _curr = 5;
		lint cnt5 = 1;
		while (true) {
			if (curr + _curr == N) {
				cout << cnt3 << " " << cnt5 << endk;
				return 0;
			}
			if (_curr > N/ 5) break;
			cnt5++;
			_curr *= 5;
		}
		if (curr > N / 3) break;
		cnt3++;
		curr *= 3;
	}
	cout << -1 << endk;
}


#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>

using namespace std;
//using namespace atcoder;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    return os << "(" << p.first << " " << p.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;
}

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;

ull rnd(void) {
    static ull y = 2463534242;
    y = y ^ (y << 13);
    y = y ^ (y >> 17);
    return y = y ^ (y << 5);
}

// edit
ll LIM = 130;

int rec(ll x, ll y) {
    if (x == 0 && y == 0) {
        return 0;
    }
    if (x == y) {
        return x + y;
    }
    if (x == 0) {
        return y;
    }
    if (y == 0) {
        return x;
    }
    if (x > y) {
//        return 1 + rec(x - y, y);
        if (x / y > LIM) return INF;
        return 1 + rec(x - y, y);
    }
    if (x < y) {
        if (y / x > LIM) return INF;
        return 1 + rec(x, y - x);
    }

    return INF;
}

void solver(ll x, ll y, vector<int> &O) {
    if (x == y) {
        if (x == 0) return;
        REP(i, x) {
            O.push_back(1);
        }
        REP(i, y) {
            O.push_back(2);
        }
    }
    if (x == 0) {
        REP(i, y) {
            O.push_back(2);
        }
    }
    if (y == 0) {
        REP(i, x) {
            O.push_back(1);
        }
    }
    if (x > y) {
        O.push_back(3);
        solver(x - y, y, O);
    }
    if (x < y) {
        O.push_back(4);
        solver(x, y - x, O);
    }
}

void solve() {
//    ll N = 100;
//    REP(i, N) {
//        cout << i << " " << rec(N, i) << endl;
//    }
    ll N;
    cin >> N;
    if (N == 1) {
        cout << 1 << endl;
        cout << 1 << endl;
        return;
    }
    ll y;
    while (true) {
        y = rnd() % (N - 1) + 1;
        ll val = rec(N, y);
        if (val <= LIM) {
//            cout << val << endl;
            break;
        } else {
//            cerr << y << " " << val << endl;
        }
    }

    vector<int> ans;
    solver(N, y, ans);
    assert(ans.size() <= LIM);
    reverse(ALL(ans));

    cout << ans.size() << endl;
    for (auto e : ans) {
        cout << e << endl;
    }

}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();

    return 0;
}

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T>>;
const int INF = 0xccccccc;
const ll LINF = 0xcccccccccccccccLL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

#define N 90
ll fib[N];

//head

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  fib[0] = 1;
  fib[1] = 1;
  for(int i = 2; i < N; i++) fib[i] = fib[i-1]+fib[i-2];
  ll n;
  cin >> n;
  vi ans;
  int fi = 1;
  for(auto i = N-1; i > 0; i--) {
    if(fib[i] <= n) {
      fi = 0;
      ans.emplace_back(i&1?2:1);
      n -= fib[i++];
    }
    else {
      if(fi) continue;
      ans.emplace_back(i&1?3:4);
    }
  }
  int k = ans.size();
  cout << k << endl;
  rep(i, k) cout << ans[i] << '\n';
  ll x = 0, y = 0;
  rep(i, k) {
    if(ans[i] == 1) x++;
    if(ans[i] == 2) y++;
    if(ans[i] == 3) x += y;
    if(ans[i] == 4) y += x;
  }
  //cerr << x << ' ' << y << endl;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<sstream>
#include<cctype>
#include<cmath>
#include<iomanip>
#include<map>
#include<stack>
#include<set>
#include<functional>
#define in(x) x=read()
#define qr read()
#define int ll
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
namespace fastIO
{
    #define BUF_SIZE 100000
    bool IOerror=0;
    inline char nc()
	{
        static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
        if (p1==pend){
            p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
            if (pend==p1){IOerror=1;return -1;}
        }
        return *p1++;
    }
    inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
    inline ll read()
	{
        bool sign=0; char ch=nc();ll x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return 0;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (sign)x=-x;
        return x;
    }
    #undef BUF_SIZE
};
using namespace fastIO;
#define mod 998244353
int fac[1000010],ifac[1000010];
int c(int x,int y){if(x<y)return 0;else return fac[x]*ifac[x-y]%mod*ifac[y]%mod;}
int qpow(int n,int k)
{
	int ans=1;
	while(k)
	{
		if(k&1)ans*=n,ans%=mod;
		n*=n,n%=mod;
		k>>=1;
	}
	return ans;
}
int n,m;
int ff[5010][5010];
int f(int x,int cnt)
{
	int ans=0;
	if(!x)return 1;
	if(x&1)return 0;
	if(!cnt)return 0;
	if(ff[x][cnt]!=-1)return ff[x][cnt];
	for(int i=0;i<=min(x,n);i+=2)
	{
		ans+=c(n,i)*f((x-i)/2,cnt-1),ans%=mod;
	}
	// cout<<x<<','<<cnt<<":"<<ans<<'\n';
	return ff[x][cnt]=ans;
}
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=qr,m=qr;
	memset(ff,-1,sizeof(ff));
	if(m&1)return cout<<0,0;
	fac[0]=1;
	for(int i=1;i<=n+m;i++)fac[i]=fac[i-1]*i%mod;
	ifac[n+m]=qpow(fac[n+m],mod-2);
	for(int i=n+m-1;i>=0;i--)ifac[i]=ifac[i+1]*(i+1)%mod;
	int cnt=0;
	for(int i=0;i<=30;i++)
	{
		if(m&(1<<i))cnt=i+1;
	}
	cout<<f(m,cnt);
	return 0;
}

#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <deque>
#include <set>
#include <limits>
#include <string>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <numeric>
#include <bitset>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, a) for (int i = 0; i < (a); ++i)
#define OUT_PREC(a, n) cout << fixed << setprecision(n) << a << endl

// nが一定の時
class CombMod
{
private:
    ll n;
    const ll _MOD = 998244353;
    vector<ll> val;
    vector<ll> inv;

public:
    CombMod(const ll &n0)
    {
        n = n0;
        val.resize(n + 1, 1);
        val[1] = n;
        inv.resize(n + 1, 1);

        // calculate in advance
        for (ll i = 2; i <= n; ++i)
        {
            inv[i] = _MOD - ((inv[_MOD % i] * (ll)(_MOD / i)) % _MOD);
            val[i] = (((val[i - 1] * (n + 1 - i)) % _MOD) * inv[i]) % _MOD;
        }
    }

    ll get(ll k)
    { // mCk
        if (k < 0)
            return 0;
        else
            return val[k];
    }
};

ll solve()
{
    int n, m;
    cin >> n >> m;
    ll MOD = 998244353;
    CombMod cm(n);
    vector<ll> dp(m + 1, 0);
    dp[0] = 1;

    for (int j = 1; j <= (m / 2); ++j)
    {
        for (int k = 0; k <= min(j, n / 2); ++k)
        {
            dp[2 * j] = (dp[2 * j] + ((dp[j - k] * cm.get(2 * k)) % MOD)) % MOD;
        }
    }

    return dp[m];
}

int main()
{
    /* solve */
    cout << solve() << endl;
    // cout << (solve() ? "Yes" : "No") << endl;
    system("pause");
}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL = (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll N, C;
  cin >> N >> C;
  vector<ll> a(N), b(N), c(N);
  REP(i, N) cin >> a[i] >> b[i] >> c[i];
  map<ll, ll> mp;
  REP(i, N) {
    a[i]--;
    b[i]--;
    mp[a[i]] += c[i];
    mp[b[i] + 1] -= c[i];
  }
  ll ans = 0, last_cost = 0, last_day = 0;
  for(auto e : mp) {
    ans += min(last_cost, C) * (e.first - last_day);
    last_cost += e.second;
    last_day = e.first;
  }
  cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define run ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0);
#define LL_MAX LLONG_MAX

#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define lb(v,x) lower_bound(v.begin(),v.end(),x)

#define mod 1000000007
int exp(int x,int y){int res=1;x=x%mod;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int modinv(int x){return exp(x,mod-2);}
int add(int a,int b){a%=mod,b%=mod;a=((a+b)%mod+mod)%mod;return a;}
int sub(int a,int b){a%=mod,b%=mod;a=((a-b)%mod+mod)%mod;return a;}
int mul(int a,int b){a%=mod,b%=mod;a=((a*b)%mod+mod)%mod;return a;}
int fac[1000009];int ncr_mod(int n,int k){int ans=fac[n];ans*=modinv(fac[k]);ans%=mod;ans*=modinv(fac[n-k]);ans%=mod;return ans;}

vector<int>v_prime;void Sieve(int n){bool prime[n + 1];memset(prime,true,sizeof(prime));for (int p = 2; p*p <=n;p++){if(prime[p] ==true) {for(int i = p*p; i<= n; i += p)prime[i]=false;}}for(int p = 2;p<= n;p++)if (prime[p])v_prime.pb(p);}
vector<int>v_factor;void factor(int n){ for (int i=1; i<=sqrt(n); i++) {if (n%i == 0) {if (n/i == i) v_factor.pb(i);else { v_factor.pb(i),v_factor.pb(n/i);};} } sort(all(v_factor)); }

int power(int x, int y){int temp;if( y == 0)return 1; temp = power(x, y / 2);if (y % 2 == 0) return temp * temp;else return x * temp * temp;}
int gcd(int a, int b){if (b == 0)return a; return gcd(b, a % b);}
int log2n( int n){ return (n > 1) ? 1 + log2n(n / 2) : 0;}

void out(vector<int>&a){for(int i=0;i<a.size();i++) cout<<a[i]<<" ";  cout<<endl;}
void sout(set<int>s){for(auto it=s.begin();it!=s.end();++it)cout<<*it<<" ";  cout<<endl;}
void mout(map<int,int>mm){for(auto it=mm.begin();it!=mm.end();++it) cout<<it->fi<<" "<<it->se<<endl;}

#define ms(a,x)  memset(a, x, sizeof(a));

#define decimal(n,k) cout<<fixed<<setprecision(k)<<n<<endl
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

// In binary search always report l-1

signed main()
{

      run;

/*
open for mod factorial

     fac[0]=1;
      for(int i=1;i<1000009;i++)
      {
          fac[i]=mul(fac[i-1],i);

      }
*/

/*
  for sieve open this and use v_prime

          int pp=pow(10,6)+100000;
               Sieve(pp);
*/

 // factor(n)  &&   USE v_factor For calculating factors && don't forget v_factor.clear();

int  t=1;

while(t--)
{
              map<int,int>mm; // it->second-->frequency

             int  n,i,x,y,ok=0,sum=0,ans=0,j,k,cnt=0,m,c=0,q,z;
             int  h[100009]={0};

                  cin>>n>>k;

            vector<int>a(n,0),b(n,0);
            vector<pair<int,int>>v;

            for(i=0;i<n;i++)
            {
              cin>>a[i]>>b[i];
              v.pb(mp(a[i],b[i]));

            }
            sort(all(v));
            for(i=0;i<n;i++)
            {
                a[i]=v[i].fi;
                b[i]=v[i].se;
            }

            int prev=0;

            for(i=0;i<n;i++)
           {
              // cout<<k<<endl;
               if(mm[a[i]]==0)
               {
                    mm[a[i]]++;
               }
               else
               {
                   k+=b[i];
                   continue;
               }
               if(a[i]-prev>k)
               {
                   prev=prev+k;
                   k=0;

                   break;

               }
               else
               {
                   k=k-(a[i]-prev);
                   k+=b[i];

                 //  cout<<k<<endl;

                   prev=a[i];

               }
           }

           prev+=k;
           cout<<prev<<endl;

}
}


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

int main() {
	ll n;
	cin >> n;
	set<ll> s;
	for (ll a = 2; a * a <= n; ++a) {
		ll x = a * a;
		while (x <= n) {
			s.insert(x);
			x *= a;
		}
	}
	cout << n - s.size() << endl;
}

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

#ifdef LOCAL
#include "/debug.h"
#else
#define db(...)
#endif

#define all(v) v.begin(), v.end()
#define pb push_back
using ll = long long;
const int NAX = 2e5 + 5, MOD = 1000000007;

int64_t solveCase(int64_t N)
{
    // TODO: edit here
    set<int64_t> ss;
    for (int64_t i = 2; i <= N; i++)
    {
        if (ss.find(i) != ss.end())
            continue;
        auto j = i * i;
        if (j > N)
            break;
        while (j <= N)
        {
            ss.insert(j);
            j *= i;
        }
        db(i, j);
    }
    return N - ss.size();
}

// generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator)
int main()
{
#ifndef LOCAL
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
    constexpr char endl = '\n';
    int64_t N;
    cin >> N;
    auto ans = solveCase(N);
    cout << ans << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans = 0;
void Main(){
    using P = pair<int, int>;
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    a--;
    b--;
    vector<vector<P>> graph(200);
    For(i,0,100){
        graph[i].push_back({i + 100, x});
        graph[i + 100].push_back({i , x});
    }
    For(i,0,99){
        graph[i + 1].push_back({i + 100, x});
        graph[i + 100].push_back({i + 1 , x});
    }
    For(i,0,99){
        graph[i].push_back({i + 1, y});
        graph[i + 1].push_back({i, y});
        graph[i + 100].push_back({i + 101, y});
        graph[i + 101].push_back({i + 100, y});
    }
    vector<int> dist(200, 1e9);
    dist[a] = 0;
    stack<P> st;
    st.push({a , 0});
    while(!st.empty()){
        auto [now, d] = st.top();
        st.pop();
        for(auto to : graph[now]){
            if(dist[to.first] > d + to.second){
                dist[to.first] = d + to.second;
                st.push({to.first, dist[to.first]});
            }
        }
    }
    cout << dist[b + 100] << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

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

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    int a,b,x,y;
    cin>>a>>b>>x>>y;

    int dist = abs(a-b);
    int cost1 = dist*y +x,cost2,cost3;
    if(a<=b)
    cost2 = 2*dist*x + x;
    else
    {
    cost2 = 2*dist*x -x;
    cost3 = x +y*(dist-1);
    cost2 = min(cost2,cost3);
    }

    cout<<min(cost1,cost2);

    return 0;
}


/**Bismillahir Rahmanir Rahim.**/
/*
         Md.Fagun Molla
         18ICTCSE006
         BSMRSTU(SHIICT)
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using db = double;
///***************************************************** CONSTANTS ******************************************************///

int const N = 1e6 + 3;
ll MOD = 1e9 + 7, fact[N];
const long long inf = (long long)1e18;
const long double PI = 3.14159265358979;

///************************************************ CONTAINER DEFINITIONS ***********************************************///

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///************************************************ SHORT FORM KEYWORDS *************************************************///

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define I insert
#define lb lower_bound
#define ub upper_bound
#define endl '\n'

///************************************************ SHORT FORM FUNCTIONS ************************************************///

#define loop(a,b) for(ll i=a;i<b;i++)
#define loopr(a,b) for(ll i=a-1;i>=b;i--)
#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sa(v) sort(v.begin(),v.end())
#define sd(v) sort(v.begin(),v.end(),greater<>())
#define rev(s) reverse(s.begin(),s.end())
#define stll(x) stoll(x, nullptr, 10);
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define all(a) a.begin(),a.end()
#define mxa(a,N) *max_element(a,a+N)
#define mna(a,N) *min_element(a,a+N)
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define io() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///************************************************ SOLUTION STARTS HERE ************************************************///
///======================================================================================================================///

void solve() {
    int n; cin>>n;
    int aa[n];
    for(int i=0; i<n; i++) cin>>aa[i];
      sort(aa,aa+n);
    for(int i=0; i<n; i++) {
      if(aa[i]!=i+1) {
        cout<<"No"<<endl;
        return;
      }
    }
    cout<<"Yes"<<endl;
}
int main()
{
  io();
  int T = 1; //cin>>T;
  while (T--) solve();
  return 0;
}

/**************************************************ALHAMDULILLAH************************************************/

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

using namespace std;

int N;
int main() {
    //45 200 , out -> 90
    cin >> N;
    vector <int> S(N);
    for (int i=0; i < N; ++i) {
        cin >> S[i];
    }
    sort(S.begin(), S.end());
    int count; count = 0;
    for (int i=0; i < N; ++i) {
        if ( i + 1 == S[i]) {
            count += 1;
        }
    }
    if (count == N) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    // cout << S[0] << S[1] << endl;
}


#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (decltype(end) i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (decltype(end) i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (decltype(beg) i = beg; end <= i; i--)
#define REP(n)              for (decltype(n) repeat_index = 0; repeat_index < n; repeat_index++)

using namespace std;

template<int64_t M = 1000000007>
class ModInt {
public:
	ModInt() : val_(0) {};

	ModInt(int64_t val) {
		this->val_ = val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0)  this->val_ += M;
	}

	operator int64_t() const {
		return this->val_;
	}

	ModInt& operator += (int64_t val) {
		this->val_ += val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0) this->val_ += M;

		return *this;
	}

	ModInt& operator -= (int64_t val) {
		this->val_ -= val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0) this->val_ += M;

		return *this;
	}

	ModInt& operator *= (int64_t val) {
		this->val_ *= val;
		this->val_ %= M;

		return *this;
	}

	ModInt& operator /= (int64_t val) {
		ModInt v = ModInt::pow(val, M - 2);
		*this *= v;

		return *this;
	}

	ModInt& operator += (int32_t val) {
		return this->operator+=((int64_t)val);
	}

	ModInt& operator -= (int32_t val) {
		return this->operator-=((int64_t)val);
	}

	ModInt& operator *= (int32_t val) {
		return this->operator*=((int64_t)val);
	}

	ModInt& operator /= (int32_t val) {
		return this->operator/=((int64_t)val);
	}

	ModInt operator + (int64_t v) const {
		ModInt ret = *this;
		return (ret += v);
	}

	ModInt operator - (int64_t v) const {
		ModInt ret = *this;
		return (ret -= v);
	}

	ModInt operator * (int64_t v) const {
		ModInt ret = *this;
		return (ret *= v);
	}

	ModInt operator / (int64_t v) const {
		ModInt ret = *this;
		return (ret /= v);
	}

	ModInt operator + (int32_t v) const {
		return this->operator+((int64_t)v);
	}

	ModInt operator - (int32_t v) const {
		return this->operator-((int64_t)v);
	}

	ModInt operator * (int32_t v) const {
		return this->operator*((int64_t)v);
	}

	ModInt operator / (int32_t v) const {
		return this->operator/((int64_t)v);
	}

	static ModInt pow(ModInt n, int64_t m) {
		if (m == 0) {
			ModInt ret(1);
			return ret;
		}
		if (m == 1) {
			return n;
		}

		ModInt v = pow(n, m / 2);
		ModInt ret = v * v;
		if (m & 1) {
			ret *= n;
		}
		return ret;
	}

	ostream& operator << (ostream& out) {
		out << this->val_;
		return out;
	}

private:
	int64_t val_;
};

void solve()
{
	int64_t n, a, b; cin >> n >> a >> b;
	ModInt<> t = n - a + 1;
	ModInt<> u = n - b + 1;
	ModInt<> v = max(n - a - b + 1, (int64_t)0);

	ModInt<> x = t * u - v * (v + 1);
	ModInt<> y = t * t * u * u - x * x;
	cout << y << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int t; cin >> t;
	REP(t) {
		solve();
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define Pr pair<ll,ll>
#define Tp tuple<int,int,int>
using Graph = vector<vector<int>>;

ll mod = 998244353;

int main() {
    ll N,M; cin >> N >> M;
    vector<Pr> br;
    rep(i,M){
        ll x,y; cin >> x >> y;
        br.push_back(make_pair(x,y));
    }
    sort(br.begin(),br.end());
    set<ll> can,temp; can.insert(N);
    ll nx = 0;
    rep(i,M){
        ll x = br[i].first; ll y = br[i].second;
        if(x!=nx){
            temp.clear(); nx = x;
        }
        bool en = false;
        rep(j,3){
            if(j==1) continue;
            if(can.count(y-1+j)){
                if(temp.count(y-1+j)) continue;
                en = true;
                if(can.count(y)) continue;
                can.insert(y); temp.insert(y);
            }
            else{
                if(!temp.count(y-1+j)) continue;
                en = true;
                if(can.count(y)) continue;
                can.insert(y); temp.insert(y);
            }
        }
        if(en) continue;
        if(can.count(y)){
            can.erase(y); temp.insert(y);
        }
    }
    //for(ll x:can) cout << x << endl;
    cout << can.size() << endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, x, y; cin >> a >> b >> x >> y;
	if(a == b)
	{
		cout << x << '\n';
		return 0;
	}
	cout << x + min(abs(a - b), abs(a - (b + 1))) * min(2 * x, y) << '\n';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define Rep(i,j,n) for(int i=j; i<n; i++)
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//0000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
//#define P pair<ll, ll>
//#define P pair<double, double>
#define PP pair<P,P>
#define T tuple<int,int,int>

int main(){
  int a,b,c,d; cin >> a >> b >> c >> d;
  if(a==c && b==d) cout << 0 << endl;
  else if(a+b==c+d || a-b==c-d || abs(a-c)+abs(b-d)<=3) cout << 1 << endl;
  else if((a+b)%2==(c+d)%2 || abs(a-c)+abs(b-d)<=6 || abs(abs(a-c)-abs(b-d))<=3) cout << 2 << endl;
  else cout << 3 << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll n; cin >> n;
	int res=0;
	for(int i=1;i<=1000000;i++){
		string s=to_string(i);
		s+=s;
		ll p=stoll(s);
		if(p<=n)res++;
	}
	printf("%d\n",res);
}

#ifdef Icry
#include "debug.h"
#else
#include <bits/stdc++.h>
#define debug(args...)
#endif

using namespace std;

int main() {
      #ifdef Icry
            auto begin = std::chrono::high_resolution_clock::now();
      #endif
      ios_base :: sync_with_stdio(0);
      cin.tie(0);

      int n; cin >> n;
      vector <double> F(n + 1, 0);
      for (int i = 1; i <= n; ++i) {
            F[i] = F[i - 1] + double(n) / double(i);
      }
      cout << fixed << setprecision(9) << F[n] - 1 << '\n';

      #ifdef Icry
            auto end = std::chrono::high_resolution_clock::now();
            cerr << setprecision(4) << fixed;
            cerr << "[Execution time: " << std::chrono::duration_cast <std::chrono::duration <double>>(end - begin).count() << " seconds]\n";
      #endif
}


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

int debug = 0;

int n, y, corr = 1, x[100];

main() {
    cin >> n;
    rep(i, 0, n) {
        cin >> x[i];
        int d = 2, ispr = 1;
        while (d * d <= x[i]) {
            if (x[i] % d == 0) {
                ispr = 0;
                break;
            }
            ++d;
        }
        if (ispr) {
            corr *= x[i];
            x[i] = 0;
        }
    }
    rep(i, 0, n) {
        if (x[i] > 0 && __gcd(x[i], corr) > 1) {
            x[i] = 0;
        }
    }
    y = 1;
    while (1) {
        int f = 1;
        rep(i, 0, n) {
            if (x[i] > 0 && __gcd(y, x[i]) == 1) {
                f = 0;
                break;
            }
        }
        if (f) {
            cout << y * corr << '\n';
            return 0;
        }
        y++;
    }
}

  #include<bits/stdc++.h>

/*

shinchanCoder Here!!

*/

using namespace std;

#define endll "\n"
#define pb push_back
#define all(x) begin(x), end(x)
#define allr(x) rbegin(x), rend(x)
#define forn(i,n) for(ll i=0;i<(n);i++)

#define sz(x) (int)(x).size()

#define ff first
#define ss second

#define mpr make_pair

#define len(x) x.length()

#define ll long long
#define ld long double
#define lli long long int

#define mod 1000000007

ll powmod(ll a,  ll b){
    if(b==0){
        return 1 ;
    }
    ll x = powmod(a,b/2);
    x = (x*x)%mod ;
    if(b%2){
        x = (a*x)%mod ;
    }
    return x;
}

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

vector<ll> prm;

void Sieve(ll n) {
  bool prime[n+1];
  memset(prime,true, sizeof(prime));
  for(ll p=2;p*p<=n;p++) {
    if(prime[p]==true) {
      for(ll i=p*p;i<=n;i+=p) {
        prime[i]=false;
      }
    }
  }
  if(!prm.empty()) {
    prm.clear();
  }
  for(ll p=2;p<=n;p++) {
    if(prime[p]) {
      prm.pb(p);
    }
  }
}

ll fact(ll n) {
    ll res = 1;
    for(ll i=2;i<=n;i++) {
        res*=i;
    }
    return res;
}

ll _lcm(ll x,ll y) {
    return x*y/__gcd(x,y);
}

ll _gcd(ll a,ll b) {
    return a%b==0 ? b : _gcd(b,a%b);
}

ll nCr(ll n,ll r) {
    return (ld)fact(n)/(ld)(fact(r)*fact(n-r));
}

ll finres=1e18;

bool isCoPrime(ll z,ll a[],ll n) {
    for(ll i=0;i<n;i++) {
        if(_gcd(a[i],z)==1) {
            return 1;
        }
    }
    return 0;
}

void solve(ll prm[15],ll i,ll res,ll a[],ll n) {
    if(i==15) {
        if(!isCoPrime(res,a,n)) {
            finres=min(finres,res);
        }
        return;
    }
    solve(prm,i+1,res*prm[i],a,n);
    solve(prm,i+1,res,a,n);
}

int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //Sieve(1000000);
    ll prm[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++) {
        cin>>a[i];
    }
    solve(prm,0,1,a,n);
    cout<<finres;
    return 0;
}


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

int N, M, K;
int dis[18][100001];
int c[18];
vector<int> g[100001];
const int ALL = (1 << 18) - 1;
const int INF = 1000000;
int dp[ALL + 1][18];

int solve(int mask, int last) {
    if (dp[mask][last] != -1) {
        return dp[mask][last];
    }

    int & res = dp[mask][last];
    res = INF;
    if (mask == ((1 << K) - 1)) {
        // cout << mask << endl;
        res = 0;
        return res;
    }

    for (int i = 0; i < K; ++i) {
        if (mask == 0) {
            res = min(res, 1 + solve(mask | (1 << i), i));
            continue;
        }

        // haven't included it yet
        if (((1 << i) & mask) == 0) {
            int d = dis[last][c[i]];
            if (d >= 0) res = min(res, d + solve(mask | (1 << i),  i));
            // cout << c[last] << " " << c[i] << " " << dis[c[last]][c[i]] << " " << res << endl;
        }
    }

    return res;
}

void getDis(int i) {
    int s = c[i];
    queue<int> q;
    q.push(s);
    dis[i][s] = 0;

    while (!q.empty()) {
        int u = q.front();
        q.pop();
        int d = dis[i][u];

        for (int v : g[u]) {
            if (dis[i][v] == -1) {
                dis[i][v] = d + 1;
                q.push(v);
            }
        }
    }
}

int main() {
    memset(dis, -1, sizeof dis);
    memset(dp, -1, sizeof dp);
    cin >> N  >> M;
    for (int i = 0; i < M; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    cin >> K;
    for (int i = 0; i < K; ++i) {
        cin >> c[i];
        getDis(i);
    }
    // cout << dis[1][3] << endl;
    int res = solve(0, 0);
    if (res == INF) {
        cout << "-1\n";
    } else {
        cout << res << "\n";
    }

    return 0;
}

#include <bits/stdc++.h>
    using namespace std;
    #define fast { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
    #define pb push_back
    #define ll long long

    #define vi vector<int>
    #define vll vector<long long>
    #define mp make_pair
    #define infi INT_MAX
    #define infl LONG_LONG_MAX
    #define infd LDBL_MAX
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define ff first
    #define ss second
    #define pll pair<ll,ll>
    #define INF 1999999996000000010
    #define endl "\n"
    #define ALL(v) v.begin(),v.end()
    #define nl cout<<"\n";
    #define pr(x) cout<<x;
    #define pr1(x) cout<<x<<" ";
    #define pr2(x,y) cout<<x<<" "<<y;
    #define deb printf("*****************************\n");
    #define idk printf("idk idk ! \n");
    #define hi printf("hi ! \n");
    #define bye printf("bye bye ! \n");
    #define o_set(ll) tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
    #define number_of_set_bits  __builtin_popcountll

    //template<typename T>
    //#define o_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
    //member functions :
    //1. order_of_key(k) : number of elements strictly lesser than k
    //2. find_by_order(k) : k-th element in the set

 vll v[300005];
 ll dp[20][(1ll<<18)];
 ll d[20][300005];
 ll k;

 void dijkstra(ll src,ll idx){
  queue<ll> q;
  q.push(src);
  d[idx][src]=0;
  while(!q.empty()){
    ll elem = q.front();
    q.pop();
    for(auto itr : v[elem]){
      if(d[idx][itr]!=INF) continue;
      d[idx][itr]=d[idx][elem]+1;
      q.push(itr);
    }
  }
}

 ll fun(ll nodeidx, ll mask, vll& p) {
     if(mask == (1ll<<k) - 1) return 0;
     else if(dp[nodeidx][mask] != -1)  return dp[nodeidx][mask];

     ll ans = 1e9;
     for(int i = 0; i <k; ++i) {
        if(mask&(1ll<<i)) continue;
        {
             ll cost = d[nodeidx][p[i]] + fun(i, mask|(1ll<<i), p );
             ans = min(ans,cost);
        }
     }
     return  dp[nodeidx][mask] = ans;
 }

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

    ll ntc=1;
    f(ks,1,ntc+1)
    {

      ll n,m; cin>>n>>m;
      f(i,0,n+3) v[i].clear();
      f(i,0,m){
          ll a,b; cin>>a>>b;
          v[a].pb(b);
          v[b].pb(a);

      }

     cin>>k;
     vll p(k);
     f(i,0,k) cin>>p[i];

     bool ok = true;

     f(i,0,k){
        f(j,0,n+1) d[i][j]=INF;
     }

     f(i,0,k){
         dijkstra(p[i],i);
         f(j,0,k) {
             if(d[i][p[j]] == INF) ok = false;
         }
     }

    //  f(i,0,k){
    //     f(j,1,n+1) cout<<d[i][j]<<" ";
    //     cout<<endl;
    // }

    if(ok == false) cout<<-1<<endl;
    else  {
        ll ans = LLONG_MAX;
        memset(dp,-1,sizeof dp);
        for(int i = 0; i <k; ++i){
            ll mask = (1<<i);
            ll here = fun(i, mask, p);
            ans = min(ans,here);
        }
        cout<<ans + 1<<endl;
    }

  }

        return 0;
}


// Problem: D - Opposite
// Contest: AtCoder - AtCoder Beginner Contest 197（Sponsored by Panasonic）
// URL: https://atcoder.jp/contests/abc197/tasks/abc197_d
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

/*

WINNERS NEVER QUIT AND QUITTERS NEVER WIN!!

Falling down is an accident, Staying down is a choice.

*/
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF LLONG_MAX/2

int main()
{
    io;
    ll n,x0,y0,xn,yn;
    cin>>n;
    cin>>x0>>y0>>xn>>yn;
    ld pi =3.141592653589793238 , theta = (2*pi)/(ld)n;

    ld xm = ((ld)(x0+xn))/2, ym = ((ld)(y0+yn))/2;

    ld x0_new = x0-xm, y0_new = y0-ym;

    ld x1_new = x0_new*cos(theta)-y0_new*sin(theta), y1_new = x0_new*sin(theta)+y0_new*cos(theta);

    ld x1 = x1_new + xm, y1 = y1_new + ym;

    cout<<setprecision(10)<<x1<<" "<<y1;
    return 0;
}

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

int main() {
  double N, x0, y0, xn2, yn2;
  cin >> N >> x0 >> y0 >> xn2 >> yn2;
  complex<double> a(x0,y0), b(xn2, yn2), c, d;
  c = (a+b)/2.0;
  d = c + (a-c)*polar(1.0, M_PI*2.0/N);

  cout << d.real() << ' ' << d.imag() << endl;
  return 0;

}


#include <bits/stdc++.h>
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define pb push_back
#define endl "\n"
#define mod 1000000007
#define vi vector<lli>
#define precision(x,y)         fixed<<setprecision(y)<<x
#define sort(a) sort(a.begin(),a.end())
#define getsetbits(n) __builtin_popcount(n)
//first idx >= val
#define lb(a,x) lower_bound(a.begin(),a.end(),x)-a.begin()
//first idx > val
#define ub(a,x) upper_bound(a.begin(),a.end(),x)-a.begin()
#define b begin()
#define e end()
#define f first
#define s second
using namespace std;
void solve(){
    lli n;
    cin>>n;
    vi a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }

    sort(a);
    lli ans = 0;
    for(int i=0;i<n;i++){
        lli x = ub(a,a[i]);
        if(x >= 0 && x<n)
            ans+=n-x;
    }
    cout<<ans<<endl;

}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
}

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define pb push_back
#define PI acos(-1.0)
#define si(n) scanf("%d",&n)
#define sll(n) scanf("%lld",&n)
#define sdbl(n) scanf("%lf",&n)
#define sstr(s) scanf("%s",s)
#define all(v) v.begin(),v.end()
#define mp make_pair
#define SP(n) cout << fixed << setprecision(n)
#define CLR(a) memset(a,0,sizeof(a))
#define SET(a) memset(a,-1,sizeof(a))
#define lcm(a,b) (max((a),(b))/__gcd((a),(b)))*min((a),(b))
#define ff first
#define ss second
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define gamma 0.5772156649015328606065120
#define dbg(a) cout << "->" << __LINE__ << ": " << #a << " = " << a << endl
#define PY printf("YES\n")
#define PN printf("NO\n")

ll setBit(ll mask, int p){ return (mask | (1 << p)); }
ll resetBit(ll mask, int p){ return (mask & ~(1 << p)); }
ll flipBit(ll mask, int p){ return (mask ^ (1 << p)); }
bool check(ll mask, int p){ return (mask & (1 << p)); }

int msb(long long N){ return N ? 63 - __builtin_clzll(N): -1; }
int lsb(long long N){ return __builtin_ffs(N) - 1;}
int countOn(ll mask){ return __builtin_popcountll(mask); }
int countOff(ll mask){ return msb(mask) - countOn(mask) + 1; }
ll bigmod(ll a, ll b, ll mod)
{
  a %= mod;
  ll ret = 1;
  while(b){
    if(b&1) ret = ret*a%mod;
    a = a*a%mod;
    b >>= 1;
  }
  return ret;
}
ll modInverse(ll a)
{
    return bigmod(a, MOD-2, MOD);
}
mt19937_64 mt_rnd_64(chrono::steady_clock::now().time_since_epoch().count());
long long rnd(long long l, long long r) {
    return (mt_rnd_64() % (r-l+1)) + l;
}
/* four directions
int fx[]={+1,-1,+0,+0};
int fy[]={+0,+0,+1,-1};*/
/* eight directions
int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};*/
/*knight directions
int fx[]= {1, -1, 1, -1, 2, 2, -2, -2};
int fy[]= {2, 2, -2, -2, 1, -1, 1, -1};*/
/*ordered set stuff
ordered_set os;
how many values are less than x
int n = os.order_of_key(x);
if the numbers are in sorted order, what is the k'th number
int p = *os.find_by_order(k);*/
int main()
{
    int a,b,c,d,x,y;
    si(a);
    si(b);
    si(c);
    si(d);
    x = max(a,b);
    y = min(d,c);
    printf("%d\n",x-y);
}


#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
//Do DEBUG OR NOT
#define DEBUG

#ifdef DEBUG
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
#else
#define debug(...) true
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

//prototype declaration
ll pow_mod(ll n, ll k, ll m);//繰り返し二乗法 return val:(n^k)%m
ll gcd(ll a, ll b);//最大公約数 2引数
ll ngcd(vector<ll> a);
ll lcm(ll a, ll b);//最小公倍数 2引数
ll nlcm(vector<ll> numbers);
bool isPrime(ll x);//素数判定
ll digsum(ll n);//桁和
vector<ll> enum_div(ll n);//約数全列挙
int stringcount(string s, char c);//特定文字カウント

//__________________________main__________________________

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

    int ans=0;
    ll TwoN=2*N;
    for(ll i = 1 ; i*i <= TwoN; i++){
        if(TwoN%i == 0){
            int temp=TwoN/i;
            temp=temp-(i-1);
            if(temp%2==0) ans++;
            if(i != 1 && i*i != TwoN){
                int temp=TwoN/i;
                temp=temp-(i-1);
                if(temp%2==0) ans++;
            }
        }
        //if(i%10000==0) cout<<i<<endl;
    }
    ans++;

    cout<<ans<<endl;

    return 0;
}

//__________________________functions_____________Ctrl+K,Ctrl+0
//繰り返し二乗法関数
ll pow_mod(ll n, ll k, ll m){//r:(n^k)%m
    ll r=1;
    for(;k>0;k=k>>1){
        if(k&1) r=(r*n)%m;
        n = (n*n) % m;
    }
    return r;
}
//最大公約数 2引数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}
//最大公約数 n引数
ll ngcd(vector<ll> a){
    ll res;
    res = a[0];
    for(int i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}
//最小公倍数 2引数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
//最小公倍数 n引数
ll nlcm(vector<ll> numbers) {
    ll res;
    res = numbers[0];
    for (int i = 1; i < numbers.size(); i++) {
        res = lcm(res, numbers[i]);
    }
    return res;
}
//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}
//桁和
ll digsum(ll n) {
    ll res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}
//約数全列挙
vector<ll> enum_div(ll n){
    vector<ll> ret;
    for(int i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            if(i != 1 && i*i != n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}
//特定文字カウント
int stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}

#include<bits/stdc++.h>

#define SORT(v) sort(v.begin(),v.end())
#define si(n) scanf("%d",&n)
#define sii(n,m) scanf("%d %d",&n,&m)
#define sl(n) scanf("%lld",&n)
#define sll(n,m) scanf("%lld %lld",&n,&m)
#define ss(cad) scanf("%s",cad)
#define all(v) (v).begin(), (v).end()
#define PB push_back
#define fst first
#define scn second
#define DBG(x) cerr << #x << " = " << (x) << endl;
#define M 1000000007
#define N_MAX 100010

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<pi> vp;

int main(){
	ll N;
	sl(N);
	ll n = 1;
	int ans = 0;
	while(N-n*(n-1)/2 > 0){
		ll tmp = N-n*(n-1)/2;
		if(tmp%n == 0){
			//cout << tmp/n << " ";
			ans++;
		}
		n++;
	}
	printf("%d\n", ans*2);
	return 0;
}


    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    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; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P = pair<int,int>;
    const int INF=1001001001;
    const int mod =1e9+7;

    int main() {
      int N,M;
      cin>>N>>M;
      vector<int>w(N),l(M),v(M);
      rep(i,N){cin>>w[i];}
      rep(i,M){cin>>l[i]>>v[i];}
      int mx=*max_element(w.begin(),w.end());
      vector<pair<int,int>>p(M);
      rep(i,M){
        if(mx>v[i]){cout<<-1<<endl;return 0;}
        p[i]={v[i],l[i]};
      }
      sort(p.begin(),p.end());
      rep(i,M-1){
        chmax(p[i+1].second,p[i].second);
      }
      vector<int>x(N);
      iota(x.begin(),x.end(),0);
      ll ans=INF;
      do{
        vector<ll>dp(N);
        rep(i,N){
          ll now=0;
          for(int j=i;j<N;j++){
            now+=w[x[j]];
            int e=lower_bound(p.begin(),p.end(),P(now,0))-p.begin();
            if(e>0){chmax(dp[j],dp[i]+p[e-1].second);}
          }
        }
        chmin(ans,dp[N-1]);
      }while(next_permutation(x.begin(),x.end()));
      cout<<ans<<endl;
      return 0;
    }

#include <bits/stdc++.h>
#define readFast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fin cin
#define ll long long
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define output(x) ((int)x && cout << "YES\n") || cout << "NO\n";
using namespace std;

#ifdef LOCAL
#define read() ifstream fin("date.in.txt");
#else
#define read() readFast;
#endif

const int N = 10;
const int M = 1e5 + 5;

int n, m;
ll v[N], wMax, l, w, wAct;
ll ans = LLONG_MAX, drum;
ll dist[N][N];

vector<pair<ll,ll>> restrictii;

void searchMaxDistance(int act, ll d) {
    if(act == n) {
        drum = max(drum, d);
        return;
    }
    for (int i = act + 1; i <= n; ++i) {
        searchMaxDistance(i, d + dist[act][i]);
    }
}

bool cmp(pair<ll,ll> a, pair<ll, ll> b) {
    if(a.first == b.first)
        return a.second > b.second;
    return a.first < b.first;
}

int main() {
    read();

    fin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        fin >> v[i];
        wMax = max(wMax, v[i]);
    }
    for (int i = 1; i <= m; ++i) {
        fin >> l >> w;
        if(w < wMax) {
            cout << -1;
            return 0;
        }
        restrictii.push_back({w, l});
    }
    restrictii.push_back({0, 0});
    sort(restrictii.begin(), restrictii.end(), cmp);

    ll mx = 0;
    for (int i = 0; i < sz(restrictii); ++i) {
        mx = max(mx, restrictii[i].second);
        restrictii[i].second = mx;
    }

    vector<int> p(n + 1);
    iota(p.begin(), p.end(), 0);

    do {
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j)
                dist[i][j] = 0;
        }
        //for (int i = 1; i <= n; ++i)
        //    cout << p[i] << " ";
        //cout << '\n';

        for (int i = 1; i < n; ++i) {
            wAct = v[p[i]];
            for (int j = i + 1; j <= n; ++j) {
                wAct += v[p[j]];

                int posNeed = upper_bound(restrictii.begin(), restrictii.end(), make_pair(wAct, 0ll)) - restrictii.begin();
                --posNeed;

                dist[i][j] = restrictii[posNeed].second;
            }
        }
        /*for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                cout << dist[i][j] << " " ;
            }
            cout << '\n';
        }
        cout << '\n';
        */drum = 0;
        searchMaxDistance(1, 0);
        ans = min(ans, drum);
        //break;
    } while(next_permutation(p.begin() + 1, p.end()));

    cout << ans << '\n';
    return 0;
}


#include <bits/stdc++.h>

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int A[4]; rep(i, 4) cin >> A[i];
    sort(A, A+4);
    cout << A[0] << endl;
    return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
bool cmp(int x,int y){
	return x>y;
}
int main()
{
	int n;
	cin>>n;
	int ans=0;
	int a,b,max=0,min=1100;
	for(int i=0;i<n;i++){
		cin>>a;
		if(a>=max) max=a;
	}
	for(int i=0;i<n;i++){
		cin>>b;
		if(b<=min) min=b;
	}
	if(max>min) ans=0;
	else{
		ans=min-max+1;
	}
	cout<<ans;
	return 0;
}


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

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

  vector<int> A(N);
  for(int i = 0; i < N; i++) cin >> A.at(i);

  bool change = false;

  if(N == 1) cout << A.at(0) << endl;
  else
  {
    int mod;
    int j;
    int max;
    int min;
    for( ; ; )
    {
      max = A.at(0);
      min = A.at(0);
      mod = A.at(0);
      j = 0;
      for(int i = 1; i < N; i++)
      {
        if(max < A.at(i)) max = A.at(i);
        else if(min > A.at(i)) min = A.at(i);
        if(mod > A.at(i))
        {
          mod = A.at(i);
          j = i;
        }
      }
      if(max == min) break;
      for(int i = 0; i < N; i++)
      {
        if(i != j) A.at(i) = A.at(i) %= mod;
        if(A.at(i) == 0) A.at(i) += mod;
      }
    }
    cout << min << endl;
  }
}

#include <bits/stdc++.h>

using ull = unsigned long long int;
using ll = long long;
using ld = long double;
using pii = std::pair<int,int>;
using pll = std::pair<ll, ll>;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using vpll = std::vector<pll>;
using namespace std;

#define rep(i,j) for(int (i)=0;(i)<(j);(i)++)
#define drep(i,j) for(int (i)=(j);(i) >= 0;(i)--)

template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}
template<class T> inline void pri(T a){cout << a << endl;}
template<class Z> using vec = vector<Z>;
template<class T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

inline void IN(void){
  return;
}

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

inline void OUT(void){
 cout << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
cout << first << " " ;
OUT(rest...);
   return;
}
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = int(1e9);
const long long int INFL = LLONG_MAX;

int n,m,k;
string S;
int ans;

vll A;

ll f(ll mod,ll n,ll x)
{
  ll dp[n+1][mod+1][mod];//
  memset(dp,-1,sizeof(dp));
  dp[0][0][0] = 0;
  rep(i,n)
  {
    rep(j,mod+1)
    {
      rep(k,mod)
      {
        if(dp[i][j][k] < 0)continue;
        chmax(dp[i+1][j][k],dp[i][j][k]);
        if(j<mod)chmax(dp[i+1][j+1][(k+A[i])%mod],dp[i][j][k] + A[i]);
      }
    }
  }
  x = x%mod;
  return dp[n][mod][x];
}

void solve()
{
  ll N;
  ll X;
  IN(N,X);
  A.resize(N);
  rep(i,N)IN(A[i]);
  ll ans = INFL;
  for(ll i=1;i<=N;i++)
  {
    ll tmp = f(i,N,X);
    //OUT(tmp);
    if(tmp>0)chmin(ans,(X - tmp)/i);
  }
  cout << ans << endl;
}

signed main (int argc, char* argv[])
{
   cin.tie(0);
   ios::sync_with_stdio(false);
   int cases=1;
   //IN(cases);
   while(cases--)solve();
   //pri(ans);
   //for(auto c : ans){cout << c << endl;}
   //cout << fixed << setprecision(15) << ans << endl;
   return 0;
}


/*input
18 0

*/
#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;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=18;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
ll mult(ll a,ll b){
    ll res=0LL;
    while(b){
        if(b&1) res=(res+a)%MOD;
        a=(a+a)%MOD;
        b>>=1;
    }
    return res%MOD;
}
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int ed[maxn][maxn];
bool vis[maxn];
int dp[(1<<18)];
inline int rec(int msk){
    if(dp[msk]!=-1) return dp[msk];
    vector<int> v;
    int z=msk;
    while(z){
        v.pb(__lg(lowb(z)));
        z-=lowb(z);
    }
    bool cl=1;
    REP(i,sz(v)){
        REP(j,i){
            if(!ed[v[i]][v[j]]){
                cl=0;
                break;
            }
        }
        if(!cl) break;
    }
    if(cl){
        return dp[msk]=1;
    }
    dp[msk]=INF;
    for(int s=msk&(msk-1);s;s=(s-1)&msk){
        MNTO(dp[msk],rec(msk^s)+rec(s));
    }
    return dp[msk];
}
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n,m;
    cin>>n>>m;
    REP(i,m){
        int a,b;
        cin>>a>>b;
        --a;
        --b;
        ed[a][b]=ed[b][a]=1;
    }
    REP(i,(1<<n)) dp[i]=-1;
    cout<<rec((1<<n)-1);
}

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(), x.end()
#define mp(x, y) make_pair(x, y)
#define sz(li) (int) (li).size()
#define endE(li) li[sz(li) - 1]
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpii vector<pair<int, int>>
#define vpll vector<pll>

template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v);
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) { cout << "[ "; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << " ]"; }
template<typename A> ostream& operator<<(ostream &cout, vector<vector<A>> const &v) { cout << "["; for (int i = 0; i < v.size(); i++) { if (i) { cout << " "; } cout << v[i]; if (i < v.size() - 1) { cout << endl; } } return cout << "]"; }
template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) { cin >> p.first; return cin >> p.second; }

void solve() {
  ll x, y, z; cin >> x >> y >> z;

  if (y % x == 0) {
    cout << z * (y / x) - 1 << endl;
  } else {
    int price = (((y * 1.0) / x) * z);

    if ((price * 1.0) / z >= ((y * 1.0) / x)) {
      price--;
    }

    cout << price << endl;

  }
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  int t = 1;

  // cin >> t;

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


#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

void display_2int(vector<vector<int>> vec) {
    int N = vec.size();
    for (int i=0; i<N; i++) {
        for (int j=0; j<vec.at(i).size(); j++) {
            cout << vec.at(i).at(j);
            if (j < vec.at(i).size()-1) {
                cout << " ";
            }
        }
        cout << endl;
    }
}

void display_1string(vector<string> strlist) {
    int N = strlist.size();
    for (int i=0; i<N; i++) {
        cout << strlist.at(i) << endl;
    }
}

void display_1int(vector<int> intlist) {
    int N = intlist.size();
    if (N>0){
      for (int i=0; i<N - 1; i++) {
          cout << intlist.at(i) << " ";
      }
      cout << intlist.at(N-1) << endl;
    }else{
      cout << endl;
    }
}

void display_1ll(vector<long long> lllist) {
    long long N = lllist.size();
    if (N>0){
      for (int i=0; i<N - 1; i++) {
          cout << lllist.at(i) << " ";
      }
      cout << lllist.at(N-1) << endl;
    }else{
      cout << endl;
    }
}

void display_1pii(vector<pair<int, int>> plst){
  for (int i=0; i<plst.size(); i++){
    cout << plst.at(i).first << " " << plst.at(i).second << endl;
  }
}

int ctoi(char c) {
    if (c>='0' && c<='9'){
        return c - '0';
    }
    return -1;
}

ll count(ll N){
    string S = to_string(N);
    ll k = S.size();
    ll toridasi = (k-1)%3 + 1;
    ll rot = (k-1)/3;
    if (rot==0){
        return 0LL;
    }
    string s = "";
    for (int i=0; i<toridasi; i++){
        s += S.at(i);
    }
    ll n = stoll(s);
    string s1 = "";
    for (int i=toridasi; i<k; i++){
        s1 += S.at(i);
    }
    ll n1 = stoll(s);
    ll ans = (N - pow(1000LL, rot)+1LL) * rot + count(pow(1000LL, rot)-1LL);
    return ans;
}

int main(){
    ll N;
    cin >> N;
    cout << count(N) << endl;
}


#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long  t,r=1,r1=0,r2=0,k=0,a,b,c=0,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    vector<tuple<string,int,
           int>>mp;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
   cin>>n>>m;
   char arr[n+1][m+1];
   l(i,0,n)
    {
        l(j,0,m)
        {
            cin>>arr[i][j];
        }
    }
    l(i,0,n)
    {
        l(j,0,m)

        {
            if(arr[i][j]=='.'&&arr[i][j+1]=='.')
        {
            c++;
        }
         if(arr[i][j]=='.'&&arr[i+1][j]=='.')
        {
            c++;
        }

        }

    }
    cout<<c<<endl;
}

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

int main(){
    LL(n);
    vector<ll> yakusuu;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            yakusuu.push_back(i);
            if(n/i!=i)yakusuu.push_back(n/i);
        }
    }
    sort(all(yakusuu));
    rep(i,yakusuu.size())out(yakusuu[i]);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=200005,INF=1<<30;

ll C[10005][105];

int main(){

    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;cin>>N;
    string S;cin>>S;
    vector<ll> A(N+1),B(N+1);
    for(int i=0;i<N+1;i++) cin>>A[i];

    int left=1,right=10001;
    while(right-left>1){
        int mid=(left+right)/2;
        for(int t=0;t<mid;t++){
            for(int i=0;i<N+1;i++){
                C[t][i]=A[i]/mid;
                if(t<A[i]%mid) C[t][i]++;
            }
        }

        bool ok=true;

        for(int t=0;t<mid;t++){
            for(int i=0;i<N;i++){
                if(S[i]=='<'){
                    if(C[t][i]>=C[t][i+1]) ok=false;
                }else{
                    if(C[t][i]<=C[t][i+1]) ok=false;
                }
            }
        }

        if(ok) left=mid;
        else right=mid;
    }

    int mid=left;

    cout<<mid<<endl;

    for(int t=0;t<mid;t++){
        for(int i=0;i<N+1;i++){
            C[t][i]=A[i]/mid;
            if(t<A[i]%mid) C[t][i]++;
            cout<<C[t][i]<<" ";
        }
        cout<<"\n";
    }

    return 0;

}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <array>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
using namespace std;

using ll = long long;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int N;
    string S;
    cin >> N >> S;
    vector<int> A(N + 1), d(N);
    for(int i = 0; i <= N; ++i){
        cin >> A[i];
        if(i)   d[i - 1] = abs(A[i] - A[i - 1]);
    }
    int k = *min_element(begin(d), end(d));
    cout << k << '\n';
    for(int j = 0; j < k; ++j){
        for(int i = 0; i <= N; ++i){
            cout << (A[i] + j) / k << (i == N ? '\n' : ' ');
        }
    }

    return 0;
}


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

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << "Line " << __LINE__ << ": " <<  #x << " = " << (x) << "\n";
#define spa << " " <<
#define fi first
#define se second
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()

using ld = long double;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;

template<typename T> using V = vector<T>;
template<typename T> using P = pair<T, T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){os << "(" << v.first << ", " << v.second << ")"; return os;}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<vector<T>> &v){ for(auto &e : v){os << e << "\n";} return os;}
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

template <class T> void UNIQUE(vector<T> &x) {sort(ALL(x));x.erase(unique(ALL(x)), x.end());}
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 (a>b) { a=b; return 1; } return 0; }
void fail() { cout << -1 << '\n'; exit(0); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<"\n";}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<"\n";};

const ll INF = (1ll<<62);
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
const ll mod = (int)1e9 + 7;
//const ll mod = 998244353;

int main(){

    ll N;
    cin >> N;
    V<ll> A(N), B(N);
    REP(i, N) cin >> A[i] >> B[i];

    ll res = INF;

    REP(i, N) chmin(res, A[i]+B[i]);

    REP(i, N){
        REP(j, N){
            if(i != j){
                chmin(res, max(A[i], B[j]));
            }
        }
    }

    cout << res << endl;

    return 0;
}

#include<bits/stdc++.h>
#define ll long long int
#define lb long long double
#define mp make_pair
#define MOD 1000000007
#define pb push_back
#define ppi pair<ll,pair<ll,ll>>
#define F(i,n) for(ll i=0;i<n;i++)
#define w(t) ll t;cin >> t;while(t--)
using namespace std;

vector<ll> divisor;
void getDivisors(ll n)
{
    for (ll i=1; i<=sqrt(n); i++)
    {
        if (n%i == 0)
        {
            // If divisors are equal, take only one
            if (n/i == i)
                divisor.push_back(i);

            else // Otherwise take both
            {
                divisor.push_back(i);
                divisor.push_back(n/i);
            }
        }
    }
}

int main()
{

    //w(t)
    {

        //cout << "Codeforces Higher rating" << endl;
        ll n;
        cin >> n;
        vector<ll> a(n),b(n);
        for(int i = 0 ; i < n ; i = i + 1){

            cin >> a[i] >> b[i];
        }
        if(n == 1)
        {
            cout << a[0] + b[0] << endl;
            return 0;
        }

        int min1ind = min_element(a.begin(),a.end()) - a.begin();
        int min2ind = min_element(b.begin(),b.end()) - b.begin();

        int x = (a[min1ind] + b[min2ind]);
        if(min1ind != min2ind) cout << max(a[min1ind],b[min2ind]) << endl;
        else
        {
            sort(a.begin(),a.end());
            sort(b.begin(),b.end());

            cout << min(x,(int)min(max(a[0],b[1]),max(a[1],b[0]))) <<endl;
        }

    }

}


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
const int INF = 1e9;
const ll LINF = 1e18;
template <class T>
void get_unique(vector<T>& x) {
    x.erase(unique(x.begin(), x.end()), x.end());
}
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (int i = 0; i < int(v.size()); i++) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for (int i = 0; i < int(v.size()); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << ' ';
    }
    return os;
}
struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) {
    }
    int root(int x) {
        return (data[x] < 0) ? x : data[x] = root(data[x]);
    }
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool find(int x, int y) {
        return root(x) == root(y);
    }
    int size(int x) {
        return -data[root(x)];
    }
};
int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    cin >> s;
    s[0][0] = s[0][w - 1] = s[h - 1][0] = s[h - 1][w - 1] = '#';
    vector<vector<int>> ys(w), xs(h);
    rep(i, h) rep(j, w) {
        if (s[i][j] == '#') {
            ys[j].push_back(i);
            xs[i].push_back(j);
        }
    }
    int ans = INF;

    UnionFind uf(h + w);
    rep(y, h) rep(i, sz(xs[y]) - 1) {
        uf.unite(xs[y][i], xs[y][i + 1]);
    }
    rep(x, w) rep(i, sz(ys[x]) - 1) {
        uf.unite(ys[x][i] + w, ys[x][i + 1] + w);
    }

    int sz_y = 0, sz_x = 0;
    rep(i, w) sz_x += uf.root(i) == i;
    rep(i, h) sz_y += uf.root(i + w) == i + w;
    cout << min(sz_y - 1, sz_x - 1) << '\n';
}

#include<bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops,fast-math")
#include <ext/pb_ds/tree_policy.hpp> // #include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> //#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds; //using namespace __gnu_pbds;
#define pb push_back
#define ins insert
#define var auto
#define F first
#define S second
#define mp make_pair
using namespace std;
typedef long long ll;
//#define int ll
typedef pair<int,int> pii;
template <class T> using oset = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
const int Max = 1000 + 10;
const int LOG = 20;
const int Mod = 1e9 + 7;
const int SQ = 100000;
const ll INF = 1e18;
const int BMSK = 4e6;

ll pw(ll a , int b = Mod - 2)
{
	if(b == 0) return 1;
	ll half = pw(a , b / 2);
	if(b % 2) return half * half % Mod * a % Mod;
	return half * half % Mod;
}

char S[Max][Max];
vector<pair<int , int> > N[Max][Max];
int val[Max][Max];
bool seen[Max][Max];
int DFS(int I , int J)
{
	seen[I][J] = true;
	int sum = val[I][J];
	for(pair<int , int> u : N[I][J])
	{
		int i = u.F , j = u.S;
		if(!seen[i][j]) sum += DFS(i , j);
	}
	return sum;
}
void solve()
{
	int h , w; cin >> h >> w;
	for(int i = 1 ; i <= h ; i++)
	{
		for(int j = 1 ; j <= w ; j++)
		{
			cin >> S[i][j];
			if(i == 1 || i == h) if(j == 1 || j == w) S[i][j] = '#' , val[i][j] = 1;
			if(S[i][j] == '#')
			{
				N[i][j].pb(mp(0 , j));
				N[i][j].pb(mp(i , 0));
				N[0][j].pb(mp(i , j));
				N[i][0].pb(mp(i , j));
			}
		}
	}

	int ans1 = 0;
	for(int i = 1 ; i <= h ; i++)
	{
		if(!seen[i][0])
		{
			ans1 += DFS(i , 0) == 0;
		}
	}
	for(int i = 0 ; i <= h ; i++)
		for(int j = 0 ; j <= w ; j++)
			seen[i][j] = 0;
	int ans2 = 0;
	for(int j = 1 ; j <= w ; j++)
	{
		if(!seen[0][j])
		{
			ans2 += DFS(0 , j) == 0;
		}
	}
	cout << min(ans1 , ans2) << '\n';
}

int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << '\n';
	//int t;cin >> t;
	//while(t--)
	solve();
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)//iをaからn
#define per(i,n,a) for (int i=a-1;i>=n;i--)//iをnからa
#define db(x) cout << #x << " = " << x << endl
#define db2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; //デバッグ用
#define all(x) (x).begin(), (x).end()
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define pb push_back
#define F first
#define S second
typedef long long ll;

//sort(all(a)); ソート
//sort(all(a),greater<int>()); 逆順ソート
//a.erase(unique(all(a)), a.end()); ソート後に重複を削除
//cout<< std::fixed << std::setprecision(15)<<0.000001<<endl; 小数点以下を表示させる
//vector<vector<int>> data(3, vector<int>(4)); int型の2次元配列(3×4要素の)の宣言

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

if(x==y){
    cout<<x;
}else{
    cout<<3-x-y;
}

    return 0;
}

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int x=0, y=0;
	cin>>x>>y;
	int ans=0;
	if(x==y){
		ans=x;
	}else{
		ans=3-x-y;
	}
	cout<<ans<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const auto maxn = int(1e5 + 5);
struct edge {
    int to, c, next;
    edge(int v, int tag, int nxt)
        : to(v), c(tag), next(nxt) {}
};
auto ans = vector<int>(maxn, -1);
auto visited = vector<bool>(maxn, false);
auto es = vector<edge>();
auto head = vector<int>(maxn, -1);
auto color = 1;
auto n = 0, m = 0;

void dfs(int p, int e, int u) {
    if (ans[p] != e) {
        ans[u] = e;
    } else {
        while (color == e) {
            color++;
            if (color > n) color = 1;
        }
        ans[u] = color++;
    }
    for (auto v = head[u]; v != -1; v = es[v].next) {
        if (!visited[es[v].to]) {
            visited[es[v].to] = true;
            dfs(u, es[v].c, es[v].to);
        }
    }
}

auto main() -> int {
    cin >> n >> m;
    auto u = 0, v = 0, c = 0, cnt = 0;
    for (auto i = 0; i < m; ++i) {
        cin >> u >> v >> c;
        es.emplace_back(v, c, head[u]);
        head[u] = cnt++;
        es.emplace_back(u, c, head[v]);
        head[v] = cnt++;
    }
    visited[1] = true;
    dfs(0, -1, 1);

    for (auto i = 1; i <= n; ++i)
        cout << ans[i] << endl;

    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;
using LD = long double;

template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
void yes(bool ok = true){ cout << (ok ? "yes" : "no") << endl; }
void Yes(bool ok = true){ cout << (ok ? "Yes" : "No") << endl; }
void YES(bool ok = true){ cout << (ok ? "YES" : "NO") << endl; }

struct Edge{
    int to, color, id;
};

int n, m;
vi ans;
vector<vector<Edge>> G;

void dfs(int v = 0, int p = -1){
    for(auto [u, co, id] : G[v]){
        if(ans[u] != -1) continue;
        if(ans[v] == co){
            ans[u] = co % n + 1;
        }else{
            ans[u] = co;
        }
        dfs(u, v);
    }
}

void Main(){
    cin >> n >> m;
    G.resize(n);
    rep(i, m){
        int u, v, c;
        cin >> u >> v >> c;
        u--; v--;
        G[v].pb({u, c, i});
        G[u].pb({v, c, i});
    }
    ans.resize(n, -1);
    ans[0] = 1;
    dfs();
    rep(i, n) cout << ans[i] << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll>
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<=e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) fo(i, n){fo(j, m)cout<<dp[i][j]<<" ";cout<<"\n";}
ll nxt(){ll x; cin >> x; return x;}
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);}
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}
void solve(){
    ll n,x;
    cin >> n >> x;
    fo(i, n){
        ll y;
        cin >> y;
        if(y!=x){
            cout << y << " ";
        }
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll TC = 1;
    //cin>>TC;
    fo(TT, TC){
        // Google,FB cout << "Case #"<< TT + 1 << ": ";
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

#include <iostream>
using namespace std;

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


#include <bits/stdc++.h>

#define mp std::make_pair
#define pb push_back
#define fr first
#define se second

typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef long long ll;

template<class T> inline T max(const T &x, const T &y) { return x > y ? x : y; }
template<class T> inline T min(const T &x, const T &y) { return x < y ? x : y; }
template<class T> inline bool chkmax(T &x, const T &y) { return x < y ? x = y, true : false; }
template<class T> inline bool chkmin(T &x, const T &y) { return x > y ? x = y, true : false; }

inline int read() {
  register int x = 0, v = 1;
  register char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') v = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * v;
}

const int MAXN = 2e5;

int n, pt1, pt2, tim1, tim2;
int fa[22][MAXN | 1], par[MAXN | 1];
int dfn1[MAXN | 1], dfn2[MAXN | 1], size[MAXN | 1], dep[MAXN | 1];
int ans[MAXN | 1];
vi e[MAXN | 1];
pii a[MAXN | 1];

int find(int x) {
  static int dep[MAXN | 1];
  std::queue<int> q;
  memset(dep, 0, sizeof(dep));
  int res = 0;
  q.push(x);
  dep[x] = 1;
  while (!q.empty()) {
    int frm = q.front(); q.pop();
    for (vi::iterator it = e[frm].begin(); it != e[frm].end(); ++it) {
      int to = *it;
      if (dep[to]) continue;
      dep[to] = dep[frm] + 1;
      q.push(to);
      if (dep[to] > dep[res]) res = to;
    }
  }
  return res;
}

void dfs1(int x, int par) {
  fa[0][x] = par; dep[x] = dep[par] + 1;
  dfn1[x] = ++tim1; size[x] = 1;
  for (int i = 1; i <= 20; ++i) fa[i][x] = fa[i - 1][fa[i - 1][x]];
  for (vi::iterator it = e[x].begin(); it != e[x].end(); ++it) {
    int to = *it;
    if (to == par) continue;
    dfs1(to, x);
    size[x] += size[to];
  }
}

void dfs2(int x, int fa) {
  dfn2[x] = ++tim2;
  for (vi::iterator it = e[x].begin(); it != e[x].end(); ++it) {
    int to = *it;
    if (to == fa) continue;
    if (dfn1[to] <= dfn1[pt2] && dfn1[to] + size[to] - 1 >= dfn1[pt2]) continue;
    dfs2(to, x);
  }
  for (vi::iterator it = e[x].begin(); it != e[x].end(); ++it) {
    int to = *it;
    if (to == fa) continue;
    if (!(dfn1[to] <= dfn1[pt2] && dfn1[to] + size[to] - 1 >= dfn1[pt2])) continue;
    dfs2(to, x);
  }
}

int lca(int x, int y) {
  if (dep[x] < dep[y]) std::swap(x, y);
  for (int i = 20; ~i; --i)
    if (dep[fa[i][x]] >= dep[y]) x = fa[i][x];
  if (x == y) return x;
  for (int i = 20; ~i; --i)
    if (fa[i][x] != fa[i][y]) x = fa[i][x], y = fa[i][y];
  return fa[0][x];
}

int dist(int x, int y) {
  if (!y) return 0;
  int res = 0, lx = x, ly = y, Lca = lca(x, y);
  return dep[x] + dep[y] - 2 * dep[Lca];
}

int main() {
  n = read();
  for (int i = 1; i < n; ++i) {
    int u = read(), v = read();
    e[u].pb(v); e[v].pb(u);
  }
  pt1 = find(1);
  pt2 = find(pt1);
  dfs1(pt1, 0);
  dfs2(pt1, 0);
  for (int i = 1; i <= n; ++i) a[i].fr = dfn2[i], a[i].se = i;
  std::sort(a + 1, a + 1 + n);
  for (int i = 1, res = 1; i <= n; ++i) {
    res += dist(a[i].se, a[i - 1].se);
    ans[a[i].se] = res;
  }
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  return 0;
}

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

#define LETS_GET_SCHWIFTY ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ff              first
#define ss              second
#define int             long long
#define ll              long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define vpii            vector<pair<int,int> >
#define all(x)          x.begin(),x.end()
#define matrixprint(arr,a,b,c,d) for(int i=a;i<=c;i++){for(int j=b;j<=d;j++){cout<<arr[i][j]<<" ";}cout<<"\n";}
#define show(arr,x,y)   for(int i=x;i<=y;i++){cout<<arr[i]<<" ";}cout<<"\n"
#define sz(x)           (int)x.size()
#define db(x)           cout<<x<<"\n";

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

//insert,find_by_order,order_of_key,lower_bound,upper_bound;

#define TRACE
#ifdef TRACE
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define deb(...)
#endif

//////////////////////////////code//////////////////////////////

const int N = 2e5 + 5;

int ans , n;
int dp[N];
vpii adj[N];

void dfs(int node,int p,int w)
{
      dp[node] = w;

      for(auto &c :adj[node])
      {
            if(c.ff == p)
              continue;

            dfs(c.ff , node , c.ss ^ dp[node]);

      }
}

void solve()
{
      cin >> n;

      for(int i = 0;i < n - 1; i++)
      {
              int u , v , w;
              cin >> u >> v >> w;
              adj[u].pb({v , w});
              adj[v].pb({u , w});
      }

      ans = 0;

      dfs(1 , -1 , 0);

      int bit[62] = {};

      for(int i = 1;i <= n ; i++)
      {
              int num = dp[i];
              int j = 0;

              while(num)
              {
                    if(num&1)
                      bit[j]++;

                    num>>=1;
                    j++;
              }
      }

      int curr = 1;

      for(int i = 0;i < 62 ; i++)
      {
            int now = bit[i];
            now *= (n - bit[i]);
            now%=mod;
            int p = curr%mod;
            now*=p;
            now%=mod;
            ans += now;
            ans%=mod;

           // deb(ans, now);

            curr<<=1;
      }

      db(ans)

}

int32_t main()
{

    LETS_GET_SCHWIFTY;

     #ifndef ONLINE_JUDGE
     freopen("INP.txt", "r", stdin);
     freopen("out.txt", "w", stdout);
     #endif

    int t = 1;
   //cin >> t;

    while (t--)
        solve();

}

// check out for following mistakes-
// if using pb operation on vector and then trying to access index..check if sizeof that vec could remain 0 only
// is using prime sieve make sure it fits
// when using factorial template or combinatorics make sure that you edit fillfac fun values and array values


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) begin(v), end(v)
using namespace std;
using P = pair<int,int>;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

ll ll_pow(ll a, ll n) {
  ll ans = 1;
  for(ll i = 0; i < n; i++) ans *= a;
  return ans;
}

int main() {
  int n;
  ll ans = 0;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);

  vector<int> cnt(n+1);
  vector<int> cnt_s(n+1);

  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  rep(i,n) cin >> c[i];

  rep(i,n){
      cnt_s[b[c[i]-1]]++;
  }

  rep(i,n){
    ans += cnt_s[a[i]];
  }
  cout << ans << endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<ll>
#define pb push_back
#define ff first
#define ss second
#define inf 2e18
#define ull unsigned long long
#define pi acos(-1.0)
#define mod 1000000007
#define lop0(n) for(ll i=0;i<n;i++)
#define lop(j,n) for(ll j=0;j<n;j++)
#define lop1(n) for(ll i=1;i<=n;i++)
#define all(v) v.begin(),v.end()
ll Set(ll N,ll pos){ return N=N | (1LL<<pos); }
ll reset(ll N,ll pos){ return N= N & ~(1LL<<pos); }
bool check(ll N,ll pos){ return (bool)(N & (1LL<<pos)); }
ll dx[] = { 1,0,-1,0 };
ll dy[] = { 0,1,0,-1 };
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
ll pos[200005],arr[200005];
main()
{
   ll n;
   cin>>n;
   if(n<0) n=0;
   cout<<n;

}


#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < (t); ++i)
#define dsrep(i,t,s) for(int i = (t)-1; i >= (s); --i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cerr<<#x<<" = "<<x<<endl;
#define bn(x) ((1<<(x))-1)
#define newline puts("")
using namespace std;
template<typename T> using vc = vector<T>;
template<typename T> using vv = vc<vc<T>>;
template<typename T> using PQ = priority_queue<T,vc<T>,greater<T> >;
using ll = long long;
using uint = unsigned;
using ull = unsigned long long;
using P = pair<int,int>;
using T3 = tuple<int,int,int>;
using vi = vc<int>;
using vvi = vv<int>;
using vl = vc<ll>;
using vp = vc<P>;
using vt = vc<T3>;
int getInt(){int x;scanf("%d",&x);return x;}
vi pm(int n, int s=0) { vi a(n); iota(rng(a),s); return a;}
template<typename T>istream& operator>>(istream&i,vc<T>&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const T&v,const string& d=""){stringstream s;rep(i,sz(v))(i?s<<d:s)<<v[i];return s.str();}
template<typename T>ostream& operator<<(ostream&o,const vc<T>&v){if(sz(v))o<<join(v," ");return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.fi<<","<<v.se;}
vc<string> split(const string& s,char d=' '){vc<string> r(1);for(char c:s)if(c==d)r.pb("");else r.back()+=c;return r;}
string operator*(const string& s,int t){return join(vc<string>(t,s));}
template<typename T1,typename T2>bool mins(T1& x,const T2&y){if(x>y){x=y;return true;}else return false;}
template<typename T1,typename T2>bool maxs(T1& x,const T2&y){if(x<y){x=y;return true;}else return false;}
template<typename T>T dup(T x, T y){return (x+y-1)/y;}
template<typename T>ll suma(const vc<T>&a){ll res(0);for(auto&&x:a)res+=x;return res;}
template<typename T>void uni(T& a){sort(rng(a));a.erase(unique(rng(a)),a.end());}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

struct Solver {
  void solve() {
    int n;
    scanf("%d",&n);
    vi a(n);
    cin>>a;
    sort(rng(a));
    double c = -n/2.;
    double s = 0;
    rep(i,n) s += a[i];
    double ans = 1e18;
    rep(i,n) {
      mins(ans, s+c*a[i]);
      s -= a[i];
      c += 1;
      mins(ans, s+c*a[i]);
    }
    ans /= n;
    printf("%.10f\n",ans);
  }
};

int main() {
  int ts = 1;
  // scanf("%d",&ts);
  rrep(ti,ts) {
    Solver solver;
    solver.solve();
  }
  return 0;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>

using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

#define MOD 1000000007
#define INF 1001001001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    ll N;
    cin>>N;
    v A(N);
    rep(i,0,N)cin>>A[i];
    sort(all(A));
    v sA(N,0);
    sA[0]=A[0];
    rep(i,1,N)sA[i]=sA[i-1]+A[i];
    ll ans = INF;
    rep(i,0,N){
        ans = min(ans,N*A[i]-2*sA[i]-2*A[i]*(N-i-1));
    }
    ans += 2*sA[N-1];
    cout<<fixed<<setprecision(10)<<double(ans)/2/N;
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <iomanip>
using namespace std;

using VI = vector <int>;
using VVI = vector <VI>;
using VVVI = vector <VVI>;
using VLL = vector <long long>;
using VVLL = vector <VLL>;
using UMI = unordered_map<int, int>;
using UMLL = unordered_map<long long, long long>;

template<class T>
class FenwickTree {
    vector <T> sum;
public:
    FenwickTree (int treeSize) {
        sum = move(vector<T>(treeSize+1));
    }

    void addVal(int idx, T val) {
        while (idx < sum.size()) {
            sum[idx] += val;
            idx += (idx & (-idx));
        }
    }

    T getVal(int idx) {
        if (idx <= 0) {
            return 0;
        }

        T ret = 0;

        while (idx) {
            ret += sum[idx];
            idx -= (idx & (-idx));
        }

        return ret;
    }

    T queryRange(int a, int b) {
        if (b < a) {
            return 0;
        }

        return getVal(b) - getVal(a-1);
    }
};

int main() {
    int N;
    long long K;
    cin >> N >> K;
    // --K;

    vector <FenwickTree<long long>> ft;
    ft.push_back(FenwickTree<long long>(N+10));
    ft.push_back(FenwickTree<long long>(N*2+10));
    ft.push_back(FenwickTree<long long>(N*3+10));

    for (int i = 1; i <= N; ++i) {
        ft[0].addVal(i, 1);
    }

    for (int i = 1; i < 3; ++i) {
        // dp[i][s] = sigma j = 1...N dp[i-1][s-j]
        int upper = (i+1)*N;
        int preupper = i*N;

        for (int s = i+1; s <= upper; ++s) {
            int t = min(s-1, preupper);
            int f = max(i, s-N);
            ft[i].addVal(s, ft[i-1].queryRange(f, t));
        }
    }

    int low = 3;
    int up = 3*N;
    int smax = 2;

    while (low <= up) {
        int mid = (low+up) / 2;
        long long comb = ft[2].queryRange(3, mid);

        if (comb < K) {
            low = mid+1;
            smax = mid;
        } else {
            up = mid-1;
        }
    }

    // cout << "SMAX " << smax << endl;
    K -= ft[2].queryRange(3, smax);
    --K;
    // cout << "DEBUG " << K << endl;
    int target = smax+1;
    VLL ans(3, 1);
    long long comb = 0;

    for (int v = 1; v <= N && v <= target-2; ++v) {
        int remain = target-v;
        long long diff = min(remain-1, N) - max(0, remain-N-1);
        long long newComb = remain <= 2*N && diff > 0 ? comb + diff : comb;
        // if (v >= 999900) {
            // cout << "V " << v << " " << newComb << endl;
        // }

        if (newComb > K || v == N || v == target-2) {
            ans[0] = v;
            K -= comb;
            break;
        }

        comb = newComb;
    }

    int remain = target-ans[0];
    int start = max(1, remain-N);
    ans[1] = min(start + K, (long long)N);
    ans[2] = remain-ans[1];

    cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;

    return 0;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

// 1-indexed
const int N = 1000010;
vector<ll> bit(N);
// a[p] ^= x
void add(int p, int x) {
  for (int i = p; i <= N; i += i & -i) {
    bit[i] ^= x;
  }
}
// a[1] ^ a[2] ^ ... ^ a[p]
ll sum(int p) {
  ll res = 0;
  for (int i = p; i > 0; i -= i & -i) {
    res ^= bit[i];
  }
  return res;
}

int main() {
  int n, q;
  cin >> n >> q;
  vector<ll> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    add(i, a[i]);
  }
  while (q--) {
    int t, x, y;
    cin >> t >> x >> y;
    if (t == 1) {
      add(x, y);
    }
    if (t == 2) {
      cout << (sum(y) ^ sum(x - 1)) << endl;
    }
  }
  return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

const int DEPTH = 19;
class SegTree {
public:
	int val[1 << (DEPTH + 1)];
	SegTree() {
		for (int i = 0; i < (1 << (DEPTH + 1)); i++) {
			val[i] = 0;
		}
	}
	void update(int pos, int x) {
		pos += (1 << DEPTH) - 1;
		val[pos] ^= x;
		while (pos > 0) {
			pos = (pos - 1) / 2;
			val[pos] = val[2 * pos + 1] ^ val[2 * pos + 2];
		}
	}
	int query(int l, int r, int a = 0, int b = (1 << DEPTH), int id = 0) {
		if (a >= r || b <= l) return 0;
		if (l <= a && b <= r) return val[id];
		int res1 = query(l, r, a, (a + b) / 2, id * 2 + 1);
		int res2 = query(l, r, (a + b) / 2, b, id * 2 + 2);
		return res1 ^ res2;
	}
};

SegTree seg;
int n, q;
int a[300000];
int t, x, y;

signed main() {
	int i;

	cin >> n >> q;
	rep(i, n) cin >> a[i];
	rep(i, n) seg.update(i, a[i]);
	rep(i, q) {
		cin >> t >> x >> y;
		x--;
		if (t == 1) { seg.update(x, y); }
		else { cout << seg.query(x, y) << endl; }
	}
	return 0;
}