#include<cstdio>
using namespace std;
int n,k,calc[200];
int dp[200][200];
char s[200];

inline int dfs(int cur,int p) {
	if(p==0) {
		if(s[cur]=='R')
			return 1;
		else if(s[cur]=='P')
			return 2;
		else if(s[cur]=='S')
			return 3;
	}
	if(dp[cur][p])
		return dp[cur][p];
	int l=dfs(cur,p-1);
	int r=dfs((cur+calc[p-1])%n,p-1);
	int ans;
	if(l==r)
		ans=l;
	else {
		if(l==1) {
			if(r==2) ans=2;
			else ans=1;
		} else if(l==2) {
			if(r==1) ans=2;
			else ans=3;
		} else if(l==3) {
			if(r==1) ans=1;
			else ans=3;
		}
	}
	dp[cur][p]=ans;
	return ans;
}

inline void prework() {
	scanf("%d%d",&n,&k);
	scanf("%s",s);
	calc[0]=1;
	for(int i=1; i<=k; i++)
		calc[i]=calc[i-1]*2%n;
	int op=dfs(0,k);
	if(op==1)
		puts("R");
	else if(op==2)
		puts("P");
	else
		puts("S");
}
int main() {
		prework();
	return 0;
}

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

char battle(char l_hand, char r_hand)
{
    if ((l_hand == 'R' && r_hand == 'S') || (l_hand == 'P' && r_hand == 'R') || (l_hand == 'S' && r_hand == 'P'))
    {
        return l_hand;
    }
    if ((r_hand == 'R' && l_hand == 'S') || (r_hand == 'P' && l_hand == 'R') || (r_hand == 'S' && l_hand == 'P'))
    {
        return r_hand;
    }
    return l_hand;
}

int main()
{
    int N, K;
    string S;

    cin >> N >> K >> S;

    for (int k = 0; k < K; k++)
    {
        string T = S + S;
        S = "";
        for (int i = 0; i < N * 2; i += 2)
        {
            S += battle(T.at(i), T.at(i + 1));
        }
    }

    cout << S.at(0) << endl;
}


#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i=0; i < (n); i++)
using namespace std;
//using namespace atcoder;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int MOD = 1000000007;
const double pi = 3.141592653589;

bool is_seven_in_ten(int x){
    while(x!=0){
        if(x % 10 == 7)
            return true;
        else{
            x /= 10;
        }
    }
    return false;
}

bool is_seven_in_eight(int x){
    while(x!=0){
        if(x % 8 == 7){
            return true;
        }
        else{
            x /= 8;
        }
    }
    return false;
}

int main() {
    int n; cin >> n;
    int ten = 0, eight = 0, ten_eight = 0;
    for(int i=1;i<=n;i++){
        if(is_seven_in_eight(i) && is_seven_in_ten(i)){
            ten_eight++;
        }
        if(is_seven_in_ten(i)){
            ten++;
        }
        if(is_seven_in_eight(i)){
            eight++;
        }
    }

    cout << n - ten - eight + ten_eight << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define tcase int _; cin >> _; while(_--)
//#define int long long
const int MOD = 1e9+7;
const int MAX = 1e6;
const int INF = 2e9;

void solve() {
	int n;
	cin >> n;
	int a1=0, a2=0;
	vector<int> v(n, 1);
	for(int i=1; i<=n; i++) {
		int ok=1;
		int x = i;
		while(x) {
			if(x%10 == 7) ok=0;
			x /= 10;
		}
		if(!ok) v[i-1] = 0;
	}
	for(int i=1; i<=n; i++) {
		int ok=1;
		for(int j=0; j<30; j+=3) {
			if(((7<<j) & i) == (7<<j)) {
				ok=0;
				break;
			}
		}
		if(!ok) v[i-1] = 0;
	}
	int ans=0;
	for(int x : v) ans += x;
	cout << ans << endl;
}

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

 	solve();

  	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

#define F first
#define S second

const int MOD = 1e9 + 7;//XXX
const int C = 26;//XXX

void add(int &x, int y){
	x += y;
	while (x >= MOD) x -= MOD;
	while (x < 0) x += MOD;
}

int fix(int x){
	while (x >= MOD) x -= MOD;
	while (x < 0) x += MOD;
	return x;
}

int pw(int a, int b){
	int ret = 1;
	while (b){
		if (b & 1)
			ret = 1ll*ret*a%MOD;
		b >>= 1;
		a = 1ll*a*a%MOD;
	}
	return ret;
}

const int MAXN = 1e6 + 10;

map<ll,ll> mp;
ll go(ll X, ll Y) {
	if(Y <= X) {
		return X - Y;
	}
	if(mp.count(Y))
		return mp[Y];
	if(Y % 2 == 0) {
		return mp[Y] = min(go(X, Y/2)+1, Y - X);
	}
	return mp[Y] = min(go(X, Y+1), go(X, Y-1)) + 1;
}

void solve() {
	ll X, Y;
	cin >> X >> Y;
	cout << go(X, Y) << "\n";
}

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

	int te = 1;
	//cin >> te;
	for (int w = 1; w <= te; w++){
		//cout << "Case #" << w << ": ";
		solve();
	}
	return 0;
}

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

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

const int MAX = 1e6+10;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int l,r;
	cin >> l >> r;
	ll res = 0;
	for(int i=2;i<=r;i++){
			int t = i;
			int fail = 0;
			int factors = 0;
			if( t%4 == 0){
					continue;
			}
			if( t%2 == 0){
					factors ++;
					t/=2;
			}
			for(int d =3;d*d<=t;d+=2){
					if( t%d ) continue;
					factors ++;
					if( t%(d*d) == 0 ){
							fail = 1;
							break;
					}
					t/=d;
			}
			if( t > 1) factors ++;
			if( fail ) continue;
			int sign = -1;
			if( factors%2 ) sign = 1;
			ll sumand = r/i - (l-1)/i;
			sumand = sumand*sumand*sign;
			res += sumand;
	}
	for(int i=max(2,l);i<=r;i++){
			res -= 2*(r/i) - 1;
	}
	cout << res << endl;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define repp(i, a, b) for(int i = a; i <= b; i++)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, b, a) for(int i = b; i >= a; i--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define in_edges(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define endl "\n"
const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 1;
ll power(ll x,ll y){ll res = 1; x%=MOD;while(y>0){if(y&1)res=(res*x)%MOD;y=y>>1,x=(x*x)%MOD;}return res;}

void pre();
void solve();
void post();

map<ull, bool> m;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t = 1;
    // cin >> t;
    pre();
    repp(tst, 1, t){
        solve();
        post();
    }

}

/*--------------------------------------------------------------------------------------------------------------------*/

void pre(){
    ull a = 3, b = 5;
    while(a < INF){
        b = 5;
        while(b < INF){
            m[a + b] = 1;
            if(b * 5 < b) break;
            b *= 5;
        }
        if(a * 3 < a) break;
        a *= 3;
    }
}

void solve(){
    ull n;
    cin >> n;

    ull a = 3, b = 5;
    ll x = 1, y = 1;
    while(a < INF){
        b = 5;
        y = 1;
        while(b < INF){
            if(a + b == n){
                cout << x << " " << y;
                return;
            }
            m[a + b] = 1;
            if(b * 5 < b) break;
            b *= 5;
            y++;
        }
        if(a * 3 < a) break;
        a *= 3;
        x++;
    }
    cout << -1;
}

void post(){}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

const ll mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
std::istream& operator>>(std::istream& is, mint& a) { return is >> a.x;}
std::ostream& operator<<(std::ostream& os, const mint& a) { return os << a.x;}

struct combination {
  std::vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

ll N, M;
mint mp[5010];

int main() {
  std::cin >> N >> M;

  mp[0] = 1;
  rep( i, N )
    mp[i+1] = mp[i]*M;

  mint ans = mint(N)*mint(M).pow(N);

  repi( x, 1, M+1 ) {
    mint dp = 1;

    repi( w, 1, N ) {
      ans -= dp*mp[N-(w+1)]*(N-w);

      dp *= M-x;
    }
  }

  std::cout << ans << endl;

  return 0;
}


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

#define FOR(i,s,t) for(int i=(s),_t=(t); i<=_t; ++i)
#define DOR(i,s,t) for(int i=(s),_t=(t); i>=_t; --i)
#define EOR(i,x) for(int i=Head[x]; ~i; i=Nxt[i])

typedef double db;
typedef long long ll;
typedef unsigned long long ull;

namespace Eddd {
	char sc() {
		return getchar();
		static const int LEN=100000;
		static char Buf[LEN],*OP=Buf,*ED=Buf;
		if(OP==ED) ED=(OP=Buf)+fread(Buf,1,LEN,stdin);
		return *OP++;
	}
	template<class T> void rd(T &x) {
		static int c,f;x=f=0;
		while(c=sc(),c<48) if(c=='-') f=1;
		do x=(x<<3)+(x<<1)+(c^48);
		while(c=sc(),c>47);if(f) x=-x;
	}
	template<class T> void pt(T x) {
		if(x<0) putchar('-'),x=-x;
		else if(!x) putchar('0');
		static int Stk[30],tp=0;
		for(; x; x/=10) Stk[tp++]=x%10;
		while(tp) putchar(Stk[--tp]^48);
	}
	template<class T> void ptk(const T &x) {
		pt(x);putchar(' ');
	}
	template<class T> void ptn(const T &x) {
		pt(x);putchar('\n');
	}
	template<class T> bool chkmi(T &x,const T &y) {
		return x>y?x=y,true:false;
	}
	template<class T> bool chkmx(T &x,const T &y) {
		return x<y?x=y,true:false;
	}
	template<class T> T gcd(const T &x,const T &y) {
		return y?gcd(y,x%y):x;
	}
}
using namespace Eddd;

int main() {
	int n,x;
	rd(n);rd(x);
	while(n--) {
		int a;
		rd(a);
		if(a!=x) ptk(a);
	}
	putchar('\n');
	return 0;
}

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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> A;
  for (int i = 0; i < N; i++) {
    int n;
    cin >> n;
    if (n != X) {
      A.push_back(n);
    }
  }
  bool first = true;
 for (int apple : A) {
   if (first) {
     first = false;
   } else {
     cout << " ";
   }
   cout << apple;
 }
  cout << endl;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll seq[4000005];
int main(){
	ll n,k;
	cin>>n>>k;
	for(int i=n;i<=n*2-1;i++)seq[i]=i+1-n;
	for(int i=n*2;i<=n*3-2;i++)seq[i]=n*3-1-i;
	ll cnt=0,sum=0,S=3;
	int l=3*n-2,r=4*n-3;
	for(int I=1;I<=3*n-2;I++){
		cnt-=seq[r+1];
		cnt+=seq[l];
		if(sum+cnt>=k)break;
		else sum+=cnt;
		l--;
		r--;
		S++;
	}
	int p;
	for(p=1;p<=r-l+1;p++){
		if(sum+seq[p+l-1]>=k)break;
		else sum+=seq[p+l-1];
	}
	for(int i=1;i<=n;i++){
		if(p+i>=S-n && p+i<S)sum++;
		if(sum==k){
			cout<<p<<' '<<i<<' '<<S-p-i<<endl;
			break;
		}
	}
	return 0;
}


#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;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a)
#define dumparr(a,n)
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

pll operator+(pll a,pll b){
  return pll(a.first+b.first,a.second+b.second);
}
pll operator-(pll a,pll b){
  return pll(a.first-b.first,a.second-b.second);
}
pll operator*(ll a,pll b){
  return pll(b.first*a,b.second*a);
}
const ll INF=(1LL<<60);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  a=abs(a);
  b=abs(b);
  if(a==0)return b;
  if(b==0)return a;
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
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(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

const long long MOD = 1000000007;

long long modpow(long long a,unsigned long long b){
  long long base=a,ans=(1LL);
  while(b){
    if(b&1){
      ans=ans*base%MOD;
    }
    base=base*base%MOD;
    b>>=1;
  }
  return ans;
}
long long invpow(long long a){
  return modpow(a,MOD-2);
}
class UF{
  vector<long> par,rank,size_uf;
  long _chunk_size;
public:
  UF(long size):_chunk_size(size){
    for (long i = 0; i < size; i++) {
      par.push_back(i);
      rank.push_back(0);
      size_uf.push_back(1);
    }
  }
  long find(long x){
    if(par[x]==x)return x;
    return par[x]=find(par[x]);
  }
  void unite(long x,long y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    --_chunk_size;
    if(rank[x]<rank[y]){
      par[x]=y;
      size_uf[y]+=size_uf[x];
    }
    else{
      par[y]=x;
      size_uf[x]+=size_uf[y];
      if(rank[x]==rank[y])rank[x]++;
    }
  }
  bool same(long x,long y){
    return find(x)==find(y);
  }
  long operator [](long x){
    return this->find(x);
  }
  long size(long x){
    x=find(x);
    return size_uf[x];
  }
  long chunk_size(){
    return this->_chunk_size;
  }
};

void solve(long long H, long long W, std::vector<std::string> S){
  ll K=0;
  UF uft(H*W),ufy(H*W);
  For(i,H){
    For(j,W){
      if(S[i][j]=='.'){
        ++K;
        if(i<H-1&&S[i+1][j]=='.'){
          uft.unite(W*i+j,W*(i+1)+j);
        }
        if(j<W-1&&S[i][j+1]=='.'){
          ufy.unite(W*i+j,W*i+j+1);
        }
      }
    }
  }
  ll all = modpow(2,K)*K%MOD;
  ll diff=0;
  For(i,H){
    For(j,W){
      if(S[i][j]=='.'){
        ll cnt=uft.size(W*i+j)+ufy.size(W*i+j)-1;
        diff=(diff+modpow(2,K-cnt))%MOD;
      }
    }
  }
  cout<<(MOD+all-diff)%MOD<<endl;
}

int main(){
  cout<<setprecision(1000);
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    std::vector<std::string> S(H);
    for(int i = 0 ; i < H ; i++){
        std::cin >> S[i];
    }
    solve(H, W, std::move(S));
    return 0;
}

#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
constexpr ll mod = 1e9 + 7;

ll modpow(ll a, ll b) {
  ll r = 1;
  while (b) {
    if (b & 1) r = r * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return r;
}

int main() {
  // ios::sync_with_stdio(false);
  // cin.tie(nullptr);
  ll n, w, h, ans = 0, cnt = 0;
  cin >> h >> w;
  string s[h];
  ll tate[h][w] = {}, yoko[h][w] = {};
  rep(i, h) cin >> s[i];
  rep(i, h) rep(j, w) if (s[i][j] == '.') cnt++;

  if (cnt == h * w) {
    ll t = h + w - 1;
    ans = (modpow(2, t) - 1) * modpow(2, h * w - t);
    ans %= mod;
    ans *= h * w;
    ans %= mod;
    cout << ans << endl;
    return 0;
  }
  ans = 0;

  rep(i, h) rep(j, w) {
    if (s[i][j] == '#') continue;
    ll now = 1;
    for (int k = i - 1; k >= 0; --k)
      if (s[k][j] == '.')
        now++;
      else
        break;

    for (int k = i + 1; k < h; ++k)
      if (s[k][j] == '.')
        now++;
      else
        break;

    for (int k = j - 1; k >= 0; --k)
      if (s[i][k] == '.')
        now++;
      else
        break;

    for (int k = j + 1; k < w; ++k)
      if (s[i][k] == '.')
        now++;
      else
        break;

    ll add = (modpow(2, now) - 1) * modpow(2, cnt - now) % mod;
    (ans += add) %= mod;
  }

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


#include<bits/stdc++.h>
using namespace std;
#define w(x) int x;cin>>x;while(x--)
#define ll long long int
#define ld long double
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define vi vector<int>
#define inf 1e18
#define mod 998244353

void solve()
{
	ll no;
	cin>>no;
	ll k=5;
	vector<ll>v5;
	vector<ll>v3;
	while(k<=inf){
		v5.pb(k);
		k=k*5;
	}
	k=3;
	while(k<=inf){
		v3.pb(k);
		k=k*3;
	}
	int n=v3.size();
	int m=v5.size();
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(v3[i]+v5[j]==no){
				cout<<i+1<<" "<<j+1<<"\n";
				return;
			}
		}
	}
	cout<<"-1\n";
}
int main() {
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r",stdin);
	freopen("output.text", "w",stdout);
#endif*/
	fast;
	/*ll t;
	cin>>t;
	while(t--)*/
	solve();
    return 0;
}

#include <iostream>
#include <climits>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <cmath>
#include <random>
#include <bitset>
#include <cstdio>
#include <numeric>
#include <cassert>
#include <ctime>
using namespace std;
#define PB push_back
#define MP make_pair
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define INF (1 << 28)
#define LLINF (1LL << 60)
#define MOD 998244353
//#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < n; i++)
#define llrep(i, n) for (ll i = 0; i < n; i++)
using ll = long long;
typedef pair<ll, ll> P;

int main()
{
    int n;
    cin>>n;
    if(floor(1.08*n)<206){
        cout << "Yay!" << endl;
    }
    else if(floor(1.08*n)==206){
        cout << "so-so" << endl;
    }
    else{
        cout << ":(" << endl;
    }
    return 0;
}


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

vector<int> G[25];

int a[25], c[25];

vector<int> tmp;

void dfs1(int u) {
    a[u] = 1;
    tmp.push_back(u);
    for (int v : G[u]) {
        if (!a[v]) dfs1(v);
    }
}

long long dfs2(int i) {
    int u = tmp[i];
    bool vis[3] = {false, false, false};
    for (int v : G[u]) {
        if (~c[v]) vis[c[v]] = true;
    }
    long long res = 0;
    for (int j = 0; j < 3; ++j) {
        if (!vis[j]) {
            c[u] = j;
            if (i == (int)tmp.size() - 1) ++res;
            else res += dfs2(i + 1);
            c[u] = -1;
        }
    }
    return res;
}

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    memset(c, -1, sizeof(c));
    for (int i = 1; i <= m; ++i) {
        int u, v;
        scanf("%d %d", &u, &v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    long long res = 1;
    for (int i = 1; i <= n; ++i) {
        if (!a[i]) {
            tmp.clear();
            dfs1(i);
            res *= dfs2(0);
        }
    }
    printf("%lld\n", res);
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;

int v[20][2];
int main() {
  int n,m;
  cin >> n >> m;
  vector<int> a(m),b(m);
  rep(i,m) cin >> a[i] >> b[i], --a[i], --b[i];
  int k;
  cin >> k;
  rep(i,k) cin >> v[i][0] >> v[i][1], --v[i][0], --v[i][1];
  int ans = 0;
  rep(x,1<<k){
    vector<bool> t(n);
    rep(i,k) t[v[i][x>>i&1]] = true;
    int res = 0;
    rep(i,m) if(t[a[i]]&&t[b[i]]) ++res;
    ans = max(ans,res);
  }
  cout << ans << endl;
}


#include<bits/stdc++.h>
#define pb emplace_back
#define pf first
#define ps second
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define Endl '\n'
#define codejam cout<<"Case #"<<t<<": ";
#define pl pair<ll,ll>
#define mod 1000000007
#define INF 1000000001
#define forn(i,n) for(ll i=0;i<n;i++)
#define MAX 200002
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

//////////////////////////////////// JAI SHREE RAM /////////////////////////////////////

void JAISHREERAM()
{
    ll n,i,j,ans=0;
    string a;
    cin>>a;
    n=a.size();
    i=0;
    while(i<n && a[i]=='0') i++;
    j=n-1;
    while(j>=0 && a[j]=='0') j--;
    while(i<j)
    {
        if(a[i]!=a[j]) return void(cout<<"No");
        i++,j--;
    }
    cout<<"Yes";
}
int main()
{
    fast;
    int T=1;
    // cin>>T;
    for(int t=1;t<=T;t++)
    {
        // codejam
        JAISHREERAM();
    }
    return 0;
}

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;

#define ll 				long long
#define eb 				emplace_back
#define mp              make_pair
#define pb              push_back
#define watch(x) 		cout << (#x) << " = " << (x) << endl;
#define w(x)			int x; cin >> x; while(x--)
#define all(x)          (x.begin(), x.end())
#define fastIO          ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define vi              vector<int>
#define lcm(x, y)       (x/__gcd(x, y))*y
#define sayHi           cout << "Say Hi!!!!!!!!!!!!!!!!!!!!!!!!!\n";
#define rep(i,k,n)      for(int i=k; i<n; i++)
#define REPR(i,k,n) 	for (int (i) = (k); (i) >= (n); (i)--)
#define sumAll(a)       (accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)         (*min_element((a).begin(), (a).end()))
#define maxe(a)         (*max_element((a).begin(), (a).end()))
#define mini(a)         (min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)         (max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x)      (lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x)      (upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define mem0(a)         (memset(a, 0, sizeof(a)))
#define mem1(a)         (memset(a, -1, sizeof(a)))
const int MAXN = (int)((1e5) + 100);
const long long MOD = 1e9 + 7;
bool isPrime(ll n){if(n<2)return false;for(ll i=2;i*i<=n; i++){if(n%i==0)return false;}return true;}
int countDigit(ll n){int count=0;while(n!=0){n/=10;++count;}return count;}
void removeCharFromString(string &str,const char &ch){str.erase(remove(str.begin(),str.end(),ch),str.end());}
void showTime() {cerr<<"\nExecution time: "<<(float)clock()/CLOCKS_PER_SEC<<" secs\n";}
long long binExp(long long base,long long pow){
    long long result=1;
    while(pow){
        if(pow%2){result*=base;}
        base*=base;
        pow/=2;
    }
    return result;
}
long long binExpMod(long long base,long long pow,long long M){
    long long result=1;
    while(pow){
        if(pow%2){result=(result*base)%M;}
        base=(base*base)%M;
        pow/=2;
    }
    return result;
}
bool sortBySecAsc(const pair<ll,ll> &a, const pair<ll,ll> &b){
    return (a.second < b.second);
}
bool sortBySecDes(const pair<ll,ll> &a, const pair<ll,ll> &b){
    return (a.second > b.second);
}
/*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif*/

/*-----------------------------------------------------------------------------------------------------------------*/

int main() {
    fastIO

    ll n;
    cin >> n;
    if(n==0) {
        cout << "Yes";
        return 0;
    }
    while(n%10 == 0) {
        n/=10;
    }
    string s, temp2;
    s = temp2 = to_string(n);

    reverse(s.begin(), s.end());
    if(temp2 == s) {
        cout << "Yes";
    }else {
        cout << "No";
    }

    return 0;
}


#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#define M 100001

int n, m, pthn, ans[M], head[M];
struct Edge {
	int nxt, to, w;
}pth[M << 2];

void add(int from, int to, int w) {
	pth[++pthn].to = to, pth[pthn].nxt = head[from];
	pth[pthn].w = w, head[from] = pthn;
}

void dfs(int u, int now, int last) {
	if (now == -1 && last == -1) ans[u] = 1;
	else if (now == last) ans[u] = now + 1;
	else if (now != last) ans[u] = now;
	if (ans[u] > n) ans[u] = 1;
	for (int i = head[u]; i; i = pth[i].nxt) {
		int v = pth[i].to;
		if (ans[v]) continue;
    dfs(v, pth[i].w, ans[u]);
	}
}

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 1, u, v, w; i <= m; ++i) {
		scanf("%d %d %d", &u, &v, &w);
		add(u, v, w), add(v, u, w);
	}
	dfs(1, -1, -1);
	for (int i = 1; i <= n; ++i) printf("%d\n", ans[i]);
	return 0;
}

#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(0);
#define tie cin.tie(NULL);
#define Inf (1LL<<62)
#define inf (1<<30)
#define ll long long
#define pr pair<int,int>
#define pb push_back
#define fr0(i,n) for(i=0;i<n;i++)
#define fr1(i,n) for(i=1;i<=n;i++)
#define no cout<<"No\n";
#define yes cout<<"Yes\n";
#define mp make_pair
#define nl cout<<"\n";
#define mem(ara,val) memset(ara,val,sizeof(ara))
#define case(cs,n) printf("Case #%d: %lld\n",cs,n)
const int mx=2e5;
const ll mod=100000007;
using namespace std;
vector<ll>a(500,Inf),b(500,Inf);
ll c[500][500];
bool mat(int n)
{
	int i,j;
	fr0(i,n) b[0]=min(c[i][0],b[0]);
	fr0(i,n) a[i]=c[i][0]-b[0];
	fr1(j,n-1)
	{
		b[j]=c[0][j]-a[0];
		fr1(i,n-1)
		{
			if(c[i][j]-a[i]!=b[j]) return 0;
		}
	}
	return 1;
}
int main()
{
	io tie
	int n,i,j;
	cin>>n;

	fr0(i,n) fr0(j,n) cin>>c[i][j];
	if(mat(n))
	{
		yes
		fr0(i,n) cout<<a[i]<<' '; nl
		fr0(i,n) cout<<b[i]<<' '; nl
	}
	else no
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<int> vll;
typedef pair<int, int> pii;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define INF 1000000007LL
#define MOD 998244353LL

const int LIM = 2e5 + 5;

void solve()
{
    int n;
    cin >> n;
    vi v(n);
    for(auto& i : v)
        cin >> i;
    sort(ALL(v));
    reverse(ALL(v));
    ll ways = 1;
    for(int i = 1; i < n; i++)
    {
        ll p = v[i - 1] - v[i] + 1;
        ways = ways * p % INF;
    }
    ways = ways * (v[n - 1] + 1) % INF;
    cout << ways << '\n';
}

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

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

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int MOD = 998244353;
int N=3141, M=2718;
long comblist[6000];
long result[6000];

long fastpow(long a, int p){
    long ans = 1;
    while(p>0){
        if (p%2==1)
            ans = ans * a % MOD;
        p >>= 1;
        a = a * a % MOD;
    }
    return ans;
}
long fastinv(long a){
    return fastpow(a, MOD - 2);
}

void preparecomb(){
    comblist[0] = 1;
    for (int i = 1; i <= N ; i++)
    {
        comblist[i] = comblist[i - 1] * (N - i + 1) % MOD * fastinv(i) % MOD;
    }

}

void print(auto x){
    cout << x << endl;
}

long solve2(){
    //result[i] == f(2i)
    result[0] = 1;
    result[1] = comblist[2];
    int i = 2;
    while(2*i<=M){
        for (int j = i>>1;j>=0&&2*(i-2*j)<=N; j--){

            result[i] += result[j] * comblist[2*(i-2*j)] % MOD;
        result[j] %= MOD;}
        i++;
    }
    return result[M / 2] % MOD;
}

int main2()
{
    cin >> N >> M;

    if (N == 1 || M % 2 == 1)
    {
        print(0);
        return 0;
    }
    if (N==2){
        print(1);
        return 0;
    }
    preparecomb();
    print(solve2());
    return 0;
}

int main(){
    while(true){
        main2();
        break;
    }
}


#include <bits/stdc++.h>
#define ld long double
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define no cout<<"NO\n";
#define yes cout<<"YES\n";
#define nl cout<<"\n";
#define sp <<" "<<
#define ull unsigned long long
#define FAST  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
using namespace std;
bool pr(int n){
    if (n <= 1)
        return 0;
    for (ll i=2;i*i<=n;i++)
        if (n%i == 0)
            return 0;
    return 1;
}
int main()
{
    FAST
    ll a,b;cin>>a>>b;
    if(a+b>=15 && b>=8){
    	cout<<1<<endl;
	}
	else if(a+b>=10 &&b>=3)
	{
		cout<<2<<endl;
	}
	else if((a+b)>=3){
		cout<<3<<endl;
	}

	else{
		cout<<4<<endl;
	}
}

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

int main() {
  int N, L;
  cin >> N >> L;
  if(N == L){
    cout << N << endl;
  }else if(N != 0 && L != 0){
    cout << 0 << endl;
  }else if(N != 1 && L != 1){
    cout << 1 << endl;
  }else{
    cout << 2 << endl;
  }
  return 0;
}


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

#define   fi(a,b) for(int i=a;i<b;i++)
#define   fj(a,b) for(int j=a;j<b;j++)
#define   ff first
#define   ss second
#define   ll long long
#define   ld long double
#define   ull unsigned long long
#define   bp(x) __builtin_popcount(x)
#define   pr(x) for(auto it: x) cout<<it<<" "; cout<<endl;
#define   getMax(x) max_element(x.begin(),x.end())
#define   getMin(x) min_element(x.begin(),x.end())
#define   endl "\n"
typedef   vector<int> vi;
typedef   vector< pair<int, int> > vii;
typedef   vector<long long> vl;
typedef   pair<int, int> pii;
typedef   pair<ll, ll> pll;
typedef   vector< pair<ll, ll> > vll;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// auto dist = uniform_int_distribution<int>(l, r);
// int dx[] = {1, 0, -1, 0};
// int dy[] = {0, 1, 0, -1};
// int dx[] = { -1, 0, 1, 1, 1, 0, -1, -1};
// int dy[] = { -1, -1, -1, 0, 1, 1, 1, 0};

vector<vi>adj;
vl depth, in, out, ans;
vector<vi> cache;
int tym = 0;

void dfs(int u = 0, int pre = -1, int dep = 0) {
	depth[u] = dep;
	in[u] = tym++;
	cache[dep].push_back(in[u]);
	for (auto v : adj[u]) {
		if (v == pre) continue;
		dfs(v, u, dep + 1);
	}
	out[u] = tym++;
}

bool isAnc(int u, int v) {
	return (in[u] <= in[v] and out[u] >= out[v]);
}

void omae_wa_mou_shindeiru(int tc) {
	int n;
	cin >> n;
	depth.assign(n, 0);
	adj.assign(n, vi({}));
	in.assign(n, 0);
	out.assign(n, 0);
	cache.assign(n + 5, vi({}));
	fi(1, n) {
		int v;
		cin >> v;
		v--;
		adj[i].push_back(v);
		adj[v].push_back(i);
	}
	dfs();
	int q;
	cin >> q;
	ans.assign(q, 0);
	fi(0, q) {
		ll u, d;
		cin >> u >> d;
		u--, d;
		cout << lower_bound(cache[d].begin(), cache[d].end(), out[u]) - lower_bound(cache[d].begin(), cache[d].end(), in[u]) << endl;
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int tc = 1;
	// cin >> tc;
	fi(1, tc + 1) {
		omae_wa_mou_shindeiru(i);
	}
}

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define eb emplace_back
#define Field(T) vector<vector<T>>
#define pq(T) priority_queue<T,vector<T>,greater<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

struct ArbitraryModInt {
  int x;
  ArbitraryModInt() : x(0) {}
  ArbitraryModInt(int64_t y) : x(y >= 0 ? y % get_mod() : (get_mod() - (-y) % get_mod()) % get_mod()) {}

  static int &get_mod() {
    static int mod = 0;
    return mod;
  }
  static void set_mod(int md) {
    get_mod() = md;
  }

  ArbitraryModInt &operator+=(const ArbitraryModInt &p) {
    if((x += p.x) >= get_mod()) x -= get_mod();
    return *this;
  }
  ArbitraryModInt &operator-=(const ArbitraryModInt &p) {
    if((x += get_mod() - p.x) >= get_mod()) x -= get_mod();
    return *this;
  }
  ArbitraryModInt &operator*=(const ArbitraryModInt &p) {
    unsigned long long a = (unsigned long long) x * p.x;
    unsigned xh = (unsigned) (a >> 32), xl = (unsigned) a, d, m;
    asm("divl %4; \n\t" : "=a" (d), "=d" (m) : "d" (xh), "a" (xl), "r" (get_mod()));
    x = m;
    return *this;
  }
  ArbitraryModInt &operator/=(const ArbitraryModInt &p) {
    *this *= p.inv();
    return *this;
  }
  ArbitraryModInt operator-() const { return ArbitraryModInt(-x); }
  ArbitraryModInt operator+(const ArbitraryModInt &p) const { return ArbitraryModInt(*this) += p; }
  ArbitraryModInt operator-(const ArbitraryModInt &p) const { return ArbitraryModInt(*this) -= p; }
  ArbitraryModInt operator*(const ArbitraryModInt &p) const { return ArbitraryModInt(*this) *= p; }
  ArbitraryModInt operator/(const ArbitraryModInt &p) const { return ArbitraryModInt(*this) /= p; }
  bool operator==(const ArbitraryModInt &p) const { return x == p.x; }
  bool operator!=(const ArbitraryModInt &p) const { return x != p.x; }

  ArbitraryModInt inv() const {
    int a = x, b = get_mod(), u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ArbitraryModInt(u);
  }
  ArbitraryModInt pow(int64_t n) const {
    ArbitraryModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os, const ArbitraryModInt &p) {
    return os << p.x;
  }
  friend istream &operator>>(istream &is, ArbitraryModInt &a) {
    int64_t t;
    is >> t;
    a = ArbitraryModInt(t);
    return (is);
  }
};

using mint = ArbitraryModInt;

void mul(vector<mint> &dp, int d) {
  int MAX = len(dp)-1;
  rrep(i,MAX+1,d) {
    dp[i] -= dp[i - d];
  }
}

void div(vector<mint> &dp, int d) {
  int MAX = len(dp);
  rep(i,d,MAX+1) {
    dp[i] += dp[i - d];
  }
}

int main() {
  int n, k, m;
  cin >> n >> k >> m;
  mint::set_mod(m);
  vector<mint> dp(n*n*k+1, 0);
  vector<vector<mint>> vals(n+1, vector<mint>(n*n*k+1));
  dp[0] = mint(1);
  vals[0][0] = dp[0];
  rep(i,1,n) {
    div(dp, i);
    mul(dp, i*(k+1));
    rep(j,0,n*n*k) {
      vals[i][j] = dp[j];
    }
  }
  rep(i,0,n) {
    mint ans = 0;
    rep(j,0,n*n*k+1) {
      ans += vals[i][j] * vals[n-i-1][j];
    }
    cout << ans*(k+1)-1 << endl;
  }
  return 0;
}


#include<bits/stdc++.h>
#define ll   long long
using namespace std;
int main(){
   int n,s,d;
   cin>>n>>s>>d;
   int sec[n];
   int pow[n];
   for(int i=0;i<n;i++){
   	cin>>sec[i];
   	cin>>pow[i];
   }
   int count=0;
   for(int i=0;i<n;i++){
   	if(sec[i]<s and pow[i]>d){
   		count++;
	   }
   }
   if(count>0){
   	cout<<"Yes"<<endl;
   }
   else{
   	cout<<"No"<<endl;
   }
}

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

//イテレーション
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
//x:コンテナ
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF32 2147483647 //2.147483647×10^{9}:32bit整数のinf
#define INF64 9223372036854775807 //9.223372036854775807×10^{18}:64bit整数のinf
//#define MOD 1000000007 //問題による
//略記
#define F first
#define S second
//出力(空白区切りで昇順に)
#define coutALL(x) for(auto i=x.begin();i!=--x.end();i++)cout<<*i<<" ";cout<<*--x.end()<<endl;

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long S, long long D, std::vector<long long> X, std::vector<long long> Y){
  REP(i, N) {
    if (X[i] < S && Y[i] > D) {
      cout << YES << endl;
      return;
    }
  }
  cout << NO << endl;
}

signed main(){
  //小数の桁数の出力指定
  cout<<fixed<<setprecision(10);
  //入力の高速化用のコード
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  long long N;
  scanf("%lld",&N);
  long long S;
  scanf("%lld",&S);
  long long D;
  scanf("%lld",&D);
  std::vector<long long> X(N);
  std::vector<long long> Y(N);
  for(ll i = 0 ; i < N ; i++){
    scanf("%lld",&X[i]);
    scanf("%lld",&Y[i]);
  }
  solve(N, S, D, std::move(X), std::move(Y));
  return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int>A(N),B(N),C(N);
    vector<int>cnt(N+1);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for(int i = 0; i < N; i++) {
        cin >> B[i];
    }
    for(int i = 0; i < N; i++) {
        cin >> C[i];
        C[i] = B[C[i]-1];
        cnt[C[i]]++;
    }
    long long ans = 0;
    for(int i = 0; i < N; i++) {
        ans += cnt[A[i]];
    }
    cout << ans << endl;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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 <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const long double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int N; cin >> N;
    VI A(N),B(N);
    REP(i,N) cin >> A[i];
    REP(i,N) cin >> B[i];
    int amax = -1, bmin = INF;
    REP(i,N){
        chmax(amax, A[i]);
        chmin(bmin, B[i]);
    }
    cout << max(0, bmin-amax+1) << endl;

}


#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long int
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(v) v.begin(),v.end()
typedef tree<pair<ll, ll>, null_type, less< pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const ll mod=(1e+9)+7;
const ll MAX = 5e5+9;
const ll INF = 1e9;
ll power(ll a,ll b,ll m = mod) {ll res = 1;while(b>0){if(b&1)res = (res*a)%m;b = b>>1;a = (a*a)%m;}return res;}

bool prime[10000];
void sieve(ll n)
{
    memset(prime, true, sizeof(prime));
    for(ll i = 2; i*i <= n; i++){
        if(prime[i]){
            for(ll p = i*i; p <= n; p += i)
                prime[p] = false;
        }
    }
    ll cnt = 0;
    for(ll i = 1; i <= n; i++){
        if(prime[i]){
            cnt++;
        }
    }
}

void factors(ll n){
    for(ll i = 1; i*i <= n; i++){
        if(n%i == 0){
            cout<<i<<" ";
            if(n/i != i){
                cout<<n/i<<" ";
            }
        }
    }
    cout<<"\n";
}

vector <ll> G[MAX];
bool vis[MAX];

void dfs(ll v){
    if(vis[v] == true)
        return;
    vis[v] = true;
    for(ll i = 0; i < G[v].size(); i++){
        dfs(G[v][i]);
    }
}

int main()
{
    fastio;
    ll t = 1;
   // cin>>t;
    while(t--)
    {
        ll a,b;
        cin >> a >> b;
        cout << a*b*1.0/100<<"\n";
    }
}

//ordered set is a policy based data structure with 2 extra funcs st.order_of_key(x) (no of elements which are strictly //smaller than x)
//find_by_order(x) returns the iterator corresponding to the xth position {1 based index}  both functions take log(n) time

#include <iostream>
#include <iomanip>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <chrono>

using namespace std;

int main(int argc, const char * argv[]) {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int N; cin >> N;
    double x0, y0, xop, yop;
    cin >> x0 >> y0 >> xop >> yop;

    double cx = (x0 + xop) / 2., cy = (y0 + yop) / 2.;
    double vx = x0 - cx, vy = y0 - cy;
    double x1 = cx + cos(2. * M_PI / N) * vx - sin(2. * M_PI / N) * vy;
    double y1 = cy + sin(2. * M_PI / N) * vx + cos(2. * M_PI / N) * vy;

    printf("%.10f %.10f\n", x1, y1);

    return 0;

}


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

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

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

int main() {
    int N; cin >> N;
    N <<= 1;
    vector<int> A(N);
    for(auto &e : A) cin >> e;

    vector< pair<int, int> > pairs;
    for(int i=0; i<N; i++) {
        pairs.emplace_back(A[i], i);
    }
    sort(pairs.rbegin(), pairs.rend());

    vector<int> isBig(N);
    for(int i=0; i<N; i++) {
        int idx = pairs[i].second;
        isBig[idx] = (i < N/2);
    }

    stack<int> stk;
    string s = "";
    for(int i=0; i<N; i++) {
        if(stk.empty() or stk.top() == isBig[i]) {
            s += "(";
            stk.push(isBig[i]);
        }
        else {
            s += ")";
            stk.pop();
        }
    }
    cout << s << endl;
    return 0;
}

//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <complex>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define itn int
#define nit int
#define ll long long
#define ms multiset
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define re register
#define ri re int
#define il inline
#define pii pair<int,int>
#define cp complex<double>
//#pra gma G CC opti mize(3)
using namespace std;
using std::bitset;
//using namespace __gnu_pbds;
const double Pi=acos(-1);
namespace fastIO {
	template<class T>
	inline void read(T &x) {
		x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		if(fu)x=-x;
	}
	inline int read() {
		int x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		return fu?-x:x;
	}
	template<class T,class... Args>
	inline void read(T& t,Args&... args) {
		read(t);
		read(args...);
	}
	char _n_u_m_[40];
	template<class T>
	inline void write(T x ) {
		if(x==0){
			putchar('0');
			return;
		}
		T tmp = x > 0 ? x : -x ;
		if( x < 0 ) putchar('-') ;
		register int cnt = 0 ;
		while( tmp > 0 ) {
			_n_u_m_[ cnt ++ ] = tmp % 10 + '0' ;
			tmp /= 10 ;
		}
		while( cnt > 0 ) putchar(_n_u_m_[ -- cnt ]) ;
	}
	template<class T>
	inline void write(T x ,char ch) {
		write(x);
		putchar(ch);
	}
}
using namespace fastIO;
pii s[400002];
ll n;
int orz;
int a[400002];
char ans[400002];
bool tp[400002];
int main() {
	cin>>n;n<<=1;
	F(i,1,n)read(a[i]);
	F(i,1,n)s[i]=make_pair(a[i],i);
	sort(s+1,s+n+1);
	F(i,1,n/2)tp[s[i].second]=1;
	F(i,1,n){
		if(tp[i]==1){
			if(orz<=0){
				--orz;
				ans[i]='(';
			}else{
				--orz;
				ans[i]=')';
			}
		}else{
			if(orz>=0){
				++orz;
				ans[i]='(';
			}else{
				++orz;
				ans[i]=')';
			}
		}
	}
	F(i,1,n)putchar(ans[i]);
	return 0;
}


//Geekio_op
#include<bits/stdc++.h>
using namespace std;
int main(){
    vector<int>v(3);
    for(int i=0;i<3;i++){
        cin >> v[i];
    }
    sort(v.begin(),v.end());
    for(int i=0;i<3-1;i++){
        if((abs(v[i]-v[i+1]))==(abs(v[i+1]-v[i+2]))){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";

}

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

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll x, y;
    if (a >= b) {
        x = a;
    } else {
        x = b;
    }
    if (c >= d) {
        y = d;
    } else {
        y = c;
    }
    cout << x - y << endl;
}


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

/*^ debug  */

template <typename A, typename B> string to_string(pair<A, B> p);
template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) { res += ", "; }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) { res += static_cast<char>('0' + v[i]); }
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) { res += ", "; }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) { return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")"; }
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) { return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")"; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

/*  debug $*/

/*^ generic definitions  */

template<typename F>
struct _RecurFun : F {
  _RecurFun(F&& f) : F(forward<F>(f)) {}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const { return F::operator()(*this, forward<Args>(args)...); }
};
template<typename F>
decltype(auto) RecurFun(F&& f) { return _RecurFun<F> { forward<F>(f) }; }

template<typename D, typename R>
vector<R> maps(const vector<D> &&d, function<R(D)> f) {
  vector<R> r(d.size());
  for (int i = 0; i < (int) d.size(); ++i) r[i] = f(d[i]);
  return r;
}

/*  generic definitions $*/

int main() {
  ios::sync_with_stdio(false);

  int N; { cin >> N; }

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

  vector<vector<int>> G(N); {
    for (int i = 0; i + 1 < N; ++i) {
      int u, v; { cin >> u >> v; --u, --v; }
      G[u].push_back(v);
      G[v].push_back(u);
    }
  }

  vector<int> res;
  set<int> bag;
  function<void(int, int)> dfs = [&](int u, int fa) {
    for (int v : G[u]) if (v != fa) {
      bool flag = false;
      if (!bag.count(C[v])) flag = true, bag.insert(C[v]), res.push_back(v);
      dfs(v, u);
      if (flag) bag.erase(C[v]);
    }
  };

  res.push_back(0);
  bag.insert(C[0]);
  dfs(0, -1);

  sort(res.begin(), res.end());
  for (int u : res) cout << u+1 << "\n";
}

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target ("avx2,avx,fma")
typedef long long int ll;
//#define int long long int
typedef long double db;
typedef pair <int,int> ii ;
typedef vector < int > vi ;
typedef vector < ii > vii ;
#define rep(i,n)                   for(int i = 0 ; i < n ; i++)
#define repu(i,a,b)                for(int i = a ; i <= b ; i++)
#define repd(i,b,a)                for(int i = b ; i >= a ; i--)
#define pb push_back
#define fi first
#define se second
#define all(p)                p.begin(),p.end()
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Endl endl
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (int)r;}
template <class T>inline void sary(T st, T nd){while(st<nd)cin>>*st++;/*sf("%d", st++);*/}
int mod=998244353;
inline ll mul(ll a, ll b){return ((a%mod)*(b%mod))%mod;}
inline ll add(ll a, ll b){return ((a%mod)+(b%mod))%mod;}
inline ll sub(ll a, ll b){return ((a%mod)-(b%mod)+mod)%mod;}
inline ll divi(ll a, ll b) { return (500000004*(a%mod))%mod; }
const int N= 5002;

int sum(int n) {
    int s=0;
    while(n) {
        s+=n%10; n/=10;
    }
    return s;

}

void solve() {
  int a,  b; cin>>a>>b;
  cout<<max(sum(a),sum(b));
}

int32_t main() {
  IOS
  int t=1;
  //cin>>t;
  #ifndef ONLINE_JUDGE
    clock_t clk = clock();
    #endif
  while(t--) solve();
  #ifndef ONLINE_JUDGE
  cerr << "\nTime (in ms): " << double(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';
  #endif
}


///********************** Bismillahir Rahmanir Rahim *****************///
#include<bits/stdc++.h>
using namespace std;

///*********************** Template Start Here ***********************///
///************************ C o n t a i n e r ************************///
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<int>::iterator vit;
typedef set<int> si;
typedef set<string> ss;
typedef set<int>::iterator sit;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef map<string, string> mss;
typedef pair<ll, ll> pll;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef double dl;

///**************************** M a r c o ****************************///
#define f first
#define s second
#define endl '\n'
#define sp <<" "<<
#define pb push_back
#define MP make_pair
#define MOD 1000000007
#define sqr(a) ((a) * (a))
#define sz(x) (int)x.size()
#define mid(l,r) ((l+r)/2)
#define fora(a) for(auto u:a)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a, b, sizeof(a))
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(auto i=0; i<n; i++)
#define rforn(i,n) for(auto i=n-1; i>=0; i--)
#define printv(a) {for(auto u:a) cout<<u<<" "; cout<<endl;}
#define printm(a) {for(auto u:a) cout<<u.f sp u.s<<endl;}
#define abid() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ssd(a,b,c) set_symmetric_difference(all(a), all(b), c.begin());
#define fori(a,b,c) {for(a = c.begin(); a!=b; a++) cout<< *a<< " "; cout<<endl;}
#define fraction(a) cout.unsetf(ios::floatfield); cout.precision(a); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

///**************************** C o n s t ****************************///
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;

///************************ Template End Here ************************///

int main()
{
    abid();

    int x,y,z;
    cin>>x>>y>>z;

    cout<<(y*z-1)/x<<endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

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

    int k;
    cin >> k;
    vint c(k), d(k);
    rep(i, k) cin >> c[i] >> d[i];

    rep(i, m) {
        --a[i];
        --b[i];
    }
    rep(i, k) {
        --c[i];
        --d[i];
    }

    int ans = 0;
    rep(i, 1<<k) {
        vbool sara(m, false);
        rep(j, k) {
            if ((i>>j)&1) sara[d[j]] = true;
            else sara[c[j]] = true;
        }
        int t = 0;
        rep(j, m) if (sara[a[j]] && sara[b[j]]) t++;
        ans = max(ans, t);
    }

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


//================code===================//

//#define TLE

#ifdef TLE
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#endif

#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <ctime>

#define ci(t) cin>>t
#define co(t) cout<<t
#define LL long long

#define ld double
#define fa(i,a,b) for(LL i=(a);i<(LL)(b);++i)
#define fd(i,a,b) for(LL i=(a);i>(LL)(b);--i)
#define setp tuple<LL,LL,LL>
#define setl pair<LL,LL>
#define micro 0.000001

using namespace std;

LL gcd(LL a, LL b) { return a % b ? gcd(b, a % b) : b; }

#ifdef OHSOLUTION
#define ce(t) cerr<<t
#define AT cerr << "\n=================ANS=================\n"
#define AE cerr << "\n=====================================\n"
#define DB(a) cerr << __LINE__ << ": " << #a << " = " << (a) << endl;
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#else
#define AT
#define AE
#define ce(t)
#endif

pair <int, int> vu[9] = { {0,-1},{1,0},{0,1} ,{-1,0},{0,0},{1,1}, {-1,1} , {1,-1},{-1,-1} }; //RDLU EWSN

template<typename T, typename U> void ckmax(T& a, U b) { a = a < b ? b : a; }
template<typename T, typename U> void ckmin(T& a, U b) { a = a > b ? b : a; }
struct gcmp { bool operator()(LL a, LL b) { return a < b; } bool operator()(setl& a, setl& b) { return a.second < b.second; } };
struct lcmp { bool operator()(LL a, LL b) { return a > b; } bool operator()(setl& a, setl& b) { return a.second > b.second; } };

const int max_v = 1e5+ 7;
const int max_k = 1e1 + 7;
const int INF = 1e9 + 7;
const LL LNF = (LL)5e18 + 7ll;
LL mod = 998244353;
template<typename T, typename U> void MOD(T& a, U b) { a += b; if (a >= mod) a -= mod; }

int main()
{
#ifdef OHSOLUTION
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; ci(n);

	vector<int> vi(n);
	fa(i, 0, n) ci(vi[i]);

	vector<int> prime;
	vector<int> sp(57);

	fa(i, 2, 57)
	{
		if (!sp[i]) prime.push_back(i);
		for (auto& x : prime)
		{
			if (i * x >= 57) break;
			sp[i * x] = x;
			if (i % x == 0) break;
		}
	}

	vector<int> tar;
	LL ans = LNF;

	auto check = [&](LL x)
	{
		fa(i, 0, n)
		{
			if (gcd(x, vi[i]) == 1) return false;
		}
		return true;
	};

	fa(i, 0, 1 << 15)
	{
		tar.clear();
		LL tmp = 1;

		fa(j, 0, 15) if (i & (1 << j)) tar.push_back(prime[j]),tmp*=prime[j];

		if(check(tmp)) ckmin(ans,tmp);
	}

	co(ans);

	return 0;
}

#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;

#define REP(i,b,e) for(int i=b; i<e; i++)
#define PRINT(vec) {printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");}
#define fi first
#define se second

const int MOD = 1e9+7;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	ll n;
	scanf("%ld", &n);

	std::set<ll> st;
	REP(i, 2, 100000){
		ll x = i;
		REP(j, 2, 40){
			x *= i;
			if(x>n) break;
			st.insert(x);
		}
	}
	printf("%ld\n", n - st.size());
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)
#define popcount __builtin_popcount

const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

int main() {
  ll N; cin >> N;
  ll a[N]; rep(i,N) cin >> a[i];
  ll b[N]; rep(i,N) cin >> b[i];
  ll result[N] = {}, ma = 0;
  rep(i,N) {
    ma = max(ma, a[i]);
    if (i==0) result[i] = ma*b[i];
    else result[i] = max(result[i-1], ma*b[i]);
  }
  debug(result,result+N);
  return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <unordered_map>
using namespace std;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) (sort(all(v)), v.erase(unique(all(v)), v.end()))
typedef long long ll;
typedef pair<int, int> p;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n;
	vector<ll> x(n), y(n);
	for (auto &a : x) cin >> a;
	for (auto &a : y) cin >> a;
	ll mx = -1, value = -1;
	for (int i = 0; i < n; i++) {
		mx = max(mx, x[i]);
		value = max(value, mx*y[i]);
		cout << value << '\n';
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
const int maxm=3e5+10;
int head[maxn],w[maxm],dis[20][maxn],nt[maxm],to[maxm],tot;
int cnt[maxn],d[maxn],vis[maxn];int n,m,c[maxn];
void add(int x,int y,int z)
{
	to[++tot]=y;w[tot]=z;nt[tot]=head[x];head[x]=tot;
}
bool spfa(int p)
{
	for(int i=1;i<=n;i++)	dis[p][i]=1e9;
	memset(vis,0,sizeof vis);
	queue<int> q;
	while(q.size())	q.pop();
	dis[p][c[p]]=0;vis[c[p]]=true;q.push(c[p]);
	while(q.size()){
		int x=q.front();q.pop();vis[x]=false;
		for(int i=head[x];i;i=nt[i]){
			int y=to[i],z=w[i];
			//cout<<dis[y]<<" "<<dis[x]+z<<endl;
			if(dis[p][y]>dis[p][x]+z){
				dis[p][y]=dis[p][x]+z;
				if(!vis[y])	q.push(y),vis[y]=true;
			}
		}
	}
	return true;
}
int dp[1<<18][20];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int t1,t2;scanf("%d%d",&t1,&t2);
		add(t1,t2,1);add(t2,t1,1);
	}
	int k;scanf("%d",&k);
	for(int i=0;i<k;i++)
		scanf("%d",&c[i]),spfa(i);
	int ans=1e9;memset(dp,0x3f,sizeof dp);
	for(int i=0;i<k;i++)
		dp[1<<i][i]=1;
	for(int s=1;s<(1<<k);s++){
		for(int i=0;i<k;i++){
			if(s&(1<<i)){
				;
			}else continue;
			for(int j=0;j<k;j++){
				if(i==j)	continue;
				if(s&(1<<j));else	continue;
				dp[s][j]=min(dp[s][j],dp[s^(1<<j)][i]+dis[i][c[j]]);
			}
		}
	}
	for(int i=0;i<k;i++)
		ans=min(ans,dp[(1<<k)-1][i]);
	if(ans==1e9)	cout<<"-1"<<endl;
	else
		cout<<ans<<endl;
}

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define li long long
#define pii pair<int, int>
#define vi vector<int>
#define li long long

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, b, e) for (int i = (int)b; i <= (int)e; i++)

const int MAXK = 17;
const int MAXN = 1e5+5;
const int INF = 1e9;

vi edges[MAXN];
int dp[(1 << MAXK)][MAXK];
int d[MAXK][MAXN];

void upd(int& x, int y) {
	x = min(x, y);
}

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	forn(i, m) {
		int x, y;
		scanf("%d%d", &x, &y);
		edges[x].pb(y);
		edges[y].pb(x);
	}
	int k;
	scanf("%d", &k);
	vi chosen(k);
	forn(i, k) {
		scanf("%d", &chosen[i]);
	}
	forn(i, k) {
		queue<int> q;
		q.push(chosen[i]);
		fore(v, 1, n) {
			d[i][v] = INF;
		}
		d[i][chosen[i]] = 0;
		while(!q.empty()) {
			int v = q.front();
			q.pop();
			for (int u : edges[v]) {
				if (d[i][u] == INF) {
					d[i][u] = d[i][v] + 1;
					q.push(u);
				}
			}
		}
	}
	/*forn(i, k) {
		fore(j, 1, n) {
			printf("d[%d][%d] = %d\n", i, j, d[i][j]);
		}
	}*/
	forn(mask, (1 << k))
		forn(last, k)
			dp[mask][last] = INF;
	forn(j, k) {
		dp[(1 << j)][j] = 1;
	}
	forn(mask, (1 << k)) {
		forn(last, k) {
			if (dp[mask][last] == INF) {
				continue;
			}
			forn(next, k) {
				if (!(mask & (1 << next)) && d[last][chosen[next]] != INF) {
					upd(dp[mask | (1 << next)][next], dp[mask][last] + d[last][chosen[next]]);
				}
			}
		}
	}
	int ans = INF;
	forn(last, k) {
		ans = min(ans, dp[(1 << k) - 1][last]);
	}
	if (ans == INF) {
		ans = -1;
	}
	printf("%d", ans);
}


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

int main() {
  int n;
  cin >> n;
  // vector<int> a(n);
  map<int,int> m;

  rep(i,n){
    int a;
    cin >> a;
    m[a]++;
  }
  // sort(m.begin(), m.end());

  ll sum = 0;
  for(auto x : m){
    n -= x.second;
    sum += (ll)n * x.second;
  }

  cout << sum << endl;
  return 0;
}


#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 1600008
#define mod 998244353
#define f first
#define s second
ll arr[sz+10],brr[sz+10];
ll num=1;
long long binpow(long long a, long long b) {
    a %= mod;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}
int main()
{
  int t=1;
  //scanf("%d",&t);
  for(int cs=1;cs<=t;cs++)
  {
   ll n,m,k;
   scanf("%lld %lld %lld",&n,&m,&k);
   for(ll i=1;i<=k;i++)
   {
   	arr[i]=binpow(i,n);
   	brr[i]=binpow(i,m);
   }
   ll ans=0;
   ll last,fast;
   if(n==1 || m==1)
   {
   	for(ll i=1;i<=k;i++)
   {
    last=(arr[i]-arr[i-1]+mod)%mod;
    ll a=k-i+1;
    fast=(brr[a]-brr[a-1]+mod)%mod;
    last=(last*fast)%mod;
    ans=(ans+last)%mod;
   }
    printf("%lld\n",ans);
    return 0;
   }
   for(ll i=1;i<=k;i++)
   {
    last=(arr[i]-arr[i-1]+mod)%mod;
    ll a=k-i+1;
    fast=(brr[a]+mod)%mod;
    last=(last*fast)%mod;
    ans=(ans+last)%mod;
   }
   printf("%lld\n",ans);
  }
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#pragma optimize("-O3")
#define int long long int
#define f first
#define s second
#define pb push_back
#define endl '\n'
const int MOD=998244353;
const int N=2e5+5;
int num[N];
int num2[N];
int ex[N];
int ex2[N];

int add(int x, int y)
{
	return (x + y) % MOD;
}

int sub(int x, int y){
	return add(x, MOD - y);
}

int mul(int x, int y)
{
	return (x * 1ll * y) % MOD;
}

int binpow(int x, int y)
{
	int z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = mul(z, x);
		x = mul(x, x);
		y /= 2;
	}
	return z;
}

int inv(int x)
{
	return binpow(x, MOD - 2);
}

main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, m, k;
	cin>>n>>m>>k;
	num[1]=1;
	ex[1]=1;
	for(int i=2; i<=k; i++){
		num[i]=sub(binpow(i, n), ex[i-1]);
		ex[i]=add(ex[i-1], num[i]);
	}

	num2[k]=1;
	ex2[k]=1;
	for(int i=k-1; i>=1; i--){
		num2[i]=sub(binpow(k-i+1, m), ex2[i+1]);
		ex2[i]=add(ex2[i+1], num2[i]);
	}
	if(n==1 && m==1){
		cout<<k;
		return 0;
	}
	if(n==1){
		int ans=0;
		for(int i=1; i<=k; i++){
			ans=add(ans, num2[i]);
		}
		cout<<ans;
		return 0;
	}
	if(m==1){
		int ans=0;
		for(int i=1; i<=k; i++){
			ans=add(ans, num[i]);
		}
		cout<<ans;
		return 0;
	}
	int ans=0;

	for(int i=1; i<=k; i++){
		ans=add(ans, mul(num[i], binpow(k-i+1, m)));
	}
	cout<<ans;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef       long long int      ll;
#define       READ               freopen("in.txt", "r", stdin);
#define       WRITE              freopen("out.txt", "w", stdout);
#define       optimize           ios::sync_with_stdio(0);cin.tie(0);
#define       RESET(a, b)        memset(a, b, sizeof(a))
#define       gcd(a, b)          __gcd(a, b)
#define       MX                 300005
#define       MOD               1000000007
#define       inf               ll(1e18)
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }
inline ll mod(ll a, ll m){ if(a<0) return ((a%m)+m)%m; else if(a<m) return a; else return (a%m); }
/*bool cmp(ll x,ll y)
{
   return x>y;
}*/
bool cmp(pair<int,int>a, pair<int,int>b)
{
   if(a.first==b.first)
      return a.second<b.second;
   else
      return a.first<b.first;
}
int main(void)
{
   optimize
   ll t,n,m,k,x,y,a[200001];
   vector<ll> v,v1,v2;
   vector< pair<ll,ll> > p,p1,p2;
   set<ll> st;
   map<ll,ll> mp;
   priority_queue<ll> pq;
   priority_queue< ll,vector<ll>,greater<ll> > lpq;
   priority_queue< pair<ll,ll> > phpq;
   priority_queue< pair<ll,ll>,vector< pair<ll,ll> >,greater< pair<ll,ll> > > plpq;
   string s;
   //cin>>t;
   //while(t--)
   {
      cin>>n>>x>>y;
      cout<<n-x+y<<endl;
   }
   return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, x;
    string str;
    cin >> n >> x >> str;
    for (char& ch : str) if (ch == 'o')x++;else x=max(0,x-1);
    cout << x << endl;
    return 0;
}


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

const ll INF = 10e16;

int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> a(m), b(m);
    vector<char> c(m);
    rep(i, m) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
    }

    vector<vector<vector<P>>> G(n, vector<vector<P>>(n));
    rep(i, m) rep(j, m) {
        if (i == j) continue;
        if (c[i] != c[j]) continue;
        G[a[i]][a[j]].push_back({b[i], b[j]});
        G[b[i]][b[j]].push_back({a[i], a[j]});
        G[a[i]][b[j]].push_back({b[i], a[j]});
        G[b[i]][a[j]].push_back({a[i], b[j]});
    }

    vector<vector<ll>> dist(n, vector<ll>(n, INF));
    queue<P> que;

    dist[0][n - 1] = 0;
    que.push({0, n - 1});

    while (!que.empty()) {
        P p = que.front();
        que.pop();

        for (P np : G[p.first][p.second]) {
            if (dist[np.first][np.second] != INF) continue;
            dist[np.first][np.second] = dist[p.first][p.second] + 1;
            que.push(np);
        }
    }

    ll ans = INF;
    rep(i, n) ans = min(ans, dist[i][i] * 2);
    rep(i, m) {
        ans = min(ans, dist[a[i]][b[i]] * 2 + 1);
        ans = min(ans, dist[b[i]][a[i]] * 2 + 1);
    }

    if (ans == INF) ans = -1;
    cout << ans << endl;
}

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

vector<pair<int,char>> adj[1000];
bool vis[1000][1000];
int best[1000][1000];

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

	int n, m;
	cin >> n >> m;

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			best[i][j] = 1e9;
		}
	}

	while (m--) {
		int u, v;
		char c;
		cin >> u >> v >> c, --u, --v;
		adj[u].emplace_back(v, c);
		adj[v].emplace_back(u, c);
	}

	best[0][n-1] = 0;
	queue<pair<int,int>> q;
	q.push({0, n-1});

	int ans = INT_MAX;

	while (!q.empty()) {
		int u, v;
		tie(u, v) = q.front();
		q.pop();
		if (vis[u][v]) continue;
		if (u == v) ans = min(ans, best[u][v]);
		vis[u][v] = true;
		for (auto [x1, c1] : adj[u]) {
			if (x1 == v) {
				ans = min(ans, best[u][v] + 1);
				continue;
			}
			for (auto [x2, c2] : adj[v]) {
				if (c1 == c2) {
					if (best[x1][x2] > best[u][v] + 2) {
						best[x1][x2] = best[u][v] + 2;
						q.push({x1, x2});
					}
				}
			}
		}
	}

	if (ans == INT_MAX) cout << "-1";
	else cout << ans;

	return 0;
}


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
// avoid unordered_map and unordered_set!!!
#include <vector>
#include <utility>

using namespace std;

using i64 = int64_t;
using u64 = uint64_t;
using i32 = int32_t;
using pi64 = pair<i64, i64>;

#define vec vector
#define let const
#define DRi64(x) i64 x; cin >> x;
#define DRS(x) string x; cin >> x;
#define DRVi64(v, n) vec<i64> v(n); { for (i64 i = 0; i < n; ++i) { cin >> v[i]; }}
#define DRpi64(x) pi64 x; cin >> x.first >> x.second;

#ifdef DEBUG
#define P(x) cerr << x << "\n"
#else
#define P(x)
#endif

constexpr i64 MAXN = 3*100*1000LL+5LL;
constexpr i64 MOD = 1000000007LL;
constexpr i64 INF64 = MOD * MOD;

template<i64 mod>
class modint_t
{
public:
    modint_t() : val_(0) {}
    // not explicit
    modint_t(const i64 x) : val_(((x % mod) + mod) % mod) {}

    modint_t& operator+=(const modint_t& o) { val_ += o.val_; val_ %= mod; return *this; }
    modint_t& operator*=(const modint_t& o) { val_ *= o.val_; val_ %= mod; return *this; }

    // only use if mod is prime!!!
    static modint_t inv(const modint_t& x)
    {
        modint_t<mod> acc(1);
        modint_t<mod> curpow(*x);
        for (i64 e = mod - 2; e; e >>= 1, curpow *= curpow)
        {
            if (e & 1)
            {
                acc *= curpow;
            }
        }
        return acc;
    }

    i64 operator*() const { return val_; }

private:
    i64 val_;
};

void
dfs(const i64 u, const i64 p, const vec<vec<pi64>>& adj, vec<i64>& dists, const i64 ancestor_edge_wt_xor = 0)
{
    dists[u] = ancestor_edge_wt_xor;
    for (let auto [child, w] : adj[u])
    {
        if (child == p)
        {
            continue;
        }
        dfs(child, u, adj, dists, ancestor_edge_wt_xor ^ w);
    }
}

int
main()
{
    ios_base::sync_with_stdio(false);
    // fast io: see 1423K
    cin.tie(nullptr);
    cout.tie(nullptr);

    DRi64(N);
    vec<vec<pi64>> adj(N + 1);
    for (i64 i = 0; i + 1 < N; ++i)
    {
        DRi64(U); DRi64(V); DRi64(W);
        adj[U].emplace_back(V, W);
        adj[V].emplace_back(U, W);
    }

    vec<i64> dists(N + 1);
    dfs(1, -1, adj, dists);

    modint_t<MOD> acc;
    for (i64 bitpos = 0; bitpos < 60; ++bitpos)
    {
        let i64 mask = 1LL << bitpos;
        i64 num_on = 0;
        for (i64 i = 1; i <= N; ++i)
        {
            num_on += !!(dists[i] & mask);
        }
        modint_t<MOD> tmp(mask);
        tmp *= num_on * (N - num_on);
        acc += tmp;
    }

    cout << *acc << "\n";

    return 0;
}

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

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

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

class ModInt{
    public:
    ll v;
    ModInt(ll _v = 0){
        if(_v >= MOD) _v %= MOD;
        v = _v;
    }
    ModInt operator+(ll n){
        return ModInt((v+n)%MOD);
    }
    ModInt operator-(ll n){
        return ModInt((v-n+MOD)%MOD);
    }
    ModInt operator*(ll n){
        if(n >= MOD) n %= MOD;
        return ModInt((v*n)%MOD);
    }
    ModInt operator/(ll n){
        return ModInt((ModInt(n).inv()*v).v%MOD);
    }

    void operator+=(ll n){
        v = (v+n)%MOD;
    }
    void operator-=(ll n){
        v = (v-n+MOD)%MOD;
    }
    void operator*=(ll n){
        v = (v*n+MOD)%MOD;
    }

    ModInt operator+(ModInt n){
        return ModInt((v+n.v)%MOD);
    }
    ModInt operator-(ModInt n){
        return ModInt((v-n.v+MOD)%MOD);
    }
    ModInt operator*(ModInt n){
        return ModInt((v*n.v)%MOD);
    }
    ModInt operator/(ModInt n){
        return ModInt((n.inv()*v).v%MOD);
    }

    void operator+=(ModInt n){
        v = (v+n.v)%MOD;
    }
    void operator-=(ModInt n){
        v = (v-n.v+MOD)%MOD;
    }
    void operator*=(ModInt n){
        v = (v*n.v)%MOD;
    }

    void operator=(ModInt n){
        v = n.v;
    }
    bool operator==(ModInt n){
        return v == n.v;
    }
    bool operator!=(ModInt n){
        return v != n.v;
    }
    void operator=(ll n){
        v = n%MOD;
    }

    ModInt inv(){
        if(v == 1) return ModInt(1);
        else return ModInt(MOD-ModInt(MOD%v).inv().v*(MOD/v)%MOD);
    }
};

ostream& operator<<(ostream& os, const ModInt& m){
    os << m.v;
    return os;
}

istream & operator >> (istream &in,  ModInt &m){
    in >> m.v;
    return in;
}

int ch[200000];
bool used[200000];
ll xo[200000];

struct edge{
    int to;
    ll cost;
};

vector<edge> g[200000];
using mint = ModInt;

void dfs(int v, ll x){
    used[v] = true;
    ch[v]++;
    xo[v] = x;
    for(edge e : g[v]){
        if(!used[e.to]){
            dfs(e.to, x^e.cost);
            ch[v] += ch[e.to];
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int n; cin >> n;
    for(int i = 0; i < n-1; i++){
        int u, v; ll w; cin >> u >> v >> w; u--; v--;
        g[v].push_back(edge{u, w});
        g[u].push_back(edge{v, w});
    }
    dfs(0, 0);
    mint ans = mint(0);
    for(int j = 0; j < 60; j++){
        ll cnt = 0;
        for(int i = 0; i < n; i++){
            if(xo[i]&(1ll<<j)) cnt++;
        }
        ans += mint(1ll<<j)*cnt*(n-cnt);
    }
    cout << ans << endl;
}


/*  -*- coding: utf-8 -*-
 *
 * f.cc: F - Max Matrix
 */

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

using namespace std;

/* constant */

const int MAX_N = 200000;
const int MAX_E2 = 1 << 19; // = 524288
const int MAX_QN = 200000;

/* typedef */

typedef long long ll;

struct Qry {
  int t, x, y;
  Qry() {}
  Qry(int _t, int _x, int _y): t(_t), x(_x), y(_y) {}
  void read() { scanf("%d%d%d", &t, &x, &y); x--; }
  void print() { printf("Qry(%d,%d,%d)\n", t, x, y); }
};

template <typename T, const int MAX_E2>
struct SegTreeSum {
  int e2;
  T nodes[MAX_E2];
  SegTreeSum() {}

  void init(int n) {
    for (e2 = 1; e2 < n; e2 <<= 1);
    //fill(nodes, nodes + MAX_E2, 0);
  }

  T &geti(int i) { return nodes[e2 - 1 + i]; }

  void set(int i, T v) {
    int j = e2 - 1 + i;
    nodes[j] = v;
    while (j > 0) {
      j = (j - 1) / 2;
      nodes[j] = nodes[j * 2 + 1] + nodes[j * 2 + 2];
    }
  }
  void add(int i, T v) { set(i, geti(i) + v); }

  T sum_range(int r0, int r1, int k, int i0, int i1) {
    if (r1 <= i0 || i1 <= r0) return 0;
    if (r0 <= i0 && i1 <= r1) return nodes[k];

    int im = (i0 + i1) / 2;
    T v0 = sum_range(r0, r1, k * 2 + 1, i0, im);
    T v1 = sum_range(r0, r1, k * 2 + 2, im, i1);
    return v0 + v1;
  }
  T sum_range(int r0, int r1) { return sum_range(r0, r1, 0, 0, e2); }
};

/* global variables */

Qry qs[MAX_QN];
int as[MAX_N], bs[MAX_N], uas[MAX_N + 1], ubs[MAX_N + 1];
SegTreeSum<int,MAX_E2> asti, bsti;
SegTreeSum<ll,MAX_E2> astl, bstl;

/* subroutines */

inline int get_index(int un, int us[], int v) {
  return lower_bound(us, us + un, v) - us;
}

/* main */

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

  int uan = 0, ubn = 0;
  uas[uan++] = ubs[ubn++] = 0;

  for (int i = 0; i < qn; i++) {
    qs[i].read();
    if (qs[i].t == 1) uas[uan++] = qs[i].y;
    else ubs[ubn++] = qs[i].y;
  }

  sort(uas, uas + uan);
  sort(ubs, ubs + ubn);
  uan = unique(uas, uas + uan) - uas;
  ubn = unique(ubs, ubs + ubn) - ubs;

  asti.init(uan), astl.init(uan);
  asti.set(0, n);
  bsti.init(ubn), bstl.init(ubn);
  bsti.set(0, m);

  ll sum = 0;
  for (int i = 0; i < qn; i++) {
    Qry &qi = qs[i];
    //qi.print();

    if (qi.t == 1) {
      int pa = as[qi.x];
      if (pa != qi.y) {
	int i0 = get_index(ubn, ubs, pa);
	sum -= (ll)pa * bsti.sum_range(0, i0) + bstl.sum_range(i0, ubn);
	int j0 = get_index(uan, uas, pa);
	asti.add(j0, -1), astl.add(j0, -pa);

	int i1 = get_index(ubn, ubs, qi.y);
	sum += (ll)qi.y * bsti.sum_range(0, i1) + bstl.sum_range(i1, ubn);
	int j1 = get_index(uan, uas, qi.y);
	asti.add(j1, 1), astl.add(j1, qi.y);
	as[qi.x] = qi.y;
      }
    }
    else {
      int pb = bs[qi.x];
      if (pb != qi.y) {
	int i0 = get_index(uan, uas, pb);
	sum -= (ll)pb * asti.sum_range(0, i0) + astl.sum_range(i0, uan);
	int j0 = get_index(ubn, ubs, pb);
	bsti.add(j0, -1), bstl.add(j0, -pb);

	int i1 = get_index(uan, uas, qi.y);
	sum += (ll)qi.y * asti.sum_range(0, i1) + astl.sum_range(i1, uan);
	int j1 = get_index(ubn, ubs, qi.y);
	bsti.add(j1, 1), bstl.add(j1, qi.y);
	bs[qi.x] = qi.y;
      }
    }

    printf("%lld\n", sum);
  }
  return 0;
}

#include "bits/stdc++.h"
#include <chrono>
#include <random>
#define lli long long int
using namespace std;
#define mod 1000000007
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define INF 2000000000
#define common cout << "Case #" << w+1 << ": "
#define maxn 1000010

void setIO(string name) {
	ios_base::sync_with_stdio(0); cin.tie(0);
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}

template< typename T>
void PVecPrint(vector<T>&v)
{
    for(int i=0;i<(int)v.size();i++)
        cout << v[i].first << "," << v[i].second << ' ';
    cout << '\n';
}
template<class T>
void VecPrint(vector<T>&v)
{
    for(int i=0;i<v.size();i++)
        cout << v[i] << ' ';
    cout << '\n';
}
/*---------------------------------------Code-----------------------------------------------------*/

struct FenwickTree {
    vector<lli> bit;
    int n;

    void build(vector<lli> &a)
    {
        n=a.size();
        bit.resize(n);
        for (int i = 0; i < a.size(); i++)
            add(i, a[i]);
    }

    lli sum(int r) {
        lli ret = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1)
            ret += bit[r];
        return ret;
    }

    lli sum(int l, int r) {
        return sum(r) - sum(l - 1);
    }

    void add(int idx, lli delta) {
        for (; idx < n; idx = idx | (idx + 1))
            bit[idx] += delta;
    }
};

int n,m,q;
vector<pair<int,pair<int,int> > >v;
set<int>s;
map<int,int>getInd;
lli ans=0;
FenwickTree F[4];
int tot;

lli getLessSum(int id,lli num)
{
    int numId=getInd[num];
    lli sum=F[id].sum(0,numId);
    return sum*1LL*num;
}

lli getMoreSum(int id,lli num)
{
    int numId=getInd[num];
    lli sum=F[id].sum(numId+1,tot+1);
    return sum;
}

int main()
{
    cin >> n >> m >> q;
    vector<int>v1(n+10,0),v2(m+10,0);
    v.resize(q);
    s.insert(0);
    for(int i=0;i<q;i++)
    {
        cin >> v[i].first >> v[i].second.first >> v[i].second.second;
        s.insert(v[i].second.second);
    }
    int ind=0;
    for(auto &num:s)
    {
        getInd[num]=ind;
        ++ind;
    }
    vector<lli>t(ind+10,0);
    for(int i=0;i<4;i++)
        F[i].build(t);
    tot=ind;
    F[0].add(0,n);
    F[1].add(0,m);
    for(int i=0;i<q;i++)
    {
        int t=v[i].first;
        if(t==1)
        {
            int pid=v[i].second.first,id=getInd[v1[pid]],nid=getInd[v[i].second.second];
            lli sum=getLessSum(1,v1[pid])+getMoreSum(3,v1[pid]);
            ans-=sum;
            F[0].add(id,-1);
            F[2].add(id,-v1[pid]);
            v1[pid]=v[i].second.second;
            F[0].add(nid,1);
            F[2].add(nid,v1[pid]);
            sum=getLessSum(1,v1[pid])+getMoreSum(3,v1[pid]);
            ans+=sum;
        }
        else
        {
            int pid=v[i].second.first,id=getInd[v2[pid]],nid=getInd[v[i].second.second];
            lli sum=getLessSum(0,v2[pid])+getMoreSum(2,v2[pid]);
            ans-=sum;
            F[1].add(id,-1);
            F[3].add(id,-v2[pid]);
            v2[pid]=v[i].second.second;
            F[1].add(nid,1);
            F[3].add(nid,v2[pid]);
            sum=getLessSum(0,v2[pid])+getMoreSum(2,v2[pid]);
            ans+=sum;
        }
        cout << ans << '\n';
    }
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
using namespace std;
random_device rnd;
mt19937 mt(rnd());

int main(){
    int n,m;
    cin >> n >> m;
    vector<string> ss(m);
    for(int i = 0;i < m;i++){
        cin >> ss[i];
    }
    sort(ss.begin(),ss.end(),[](const string a, const string b){
        return a.size() > b.size();
    });
    //for (auto e:ss){
    //    cerr << e << endl;
    //}
    vector<string> newss;
    vector<int> val;
    for (int i = 0;i < m;i++){
        if (i == 0) {
            newss.push_back(ss[i]);
            val.push_back(1);
        }
        else{
            int len = newss.back().size();
            if (len + ss[i].size() <= 20){
                string adds = newss.back()+ss[i];
                newss.pop_back();
                newss.push_back(adds);
                val.back()++;
            }
            else{
                newss.push_back(ss[i]);
                val.push_back(1);
            }
        }
    }
    //max val
    int maxval = -1;
    int maxidx = 0;
    for (int i = 0; i < val.size();i++){
        if (val[i] > maxval){
            maxidx = i;
            maxval = val[i];
        }
    }
    int len = newss.size();
    vector<string> ans;

    for (int i = 0; i < 20;i++){
        if (len-1 < i){
            string st = newss[maxidx];
            while(st.size() < 20){
                char c = 'A'+(mt())%8;
                st += c;
            }
            ans.push_back(st);

        }
        else{
            if (newss[i].size() < 20){
                int clen = newss[i].size();
                for (int t = 0; t < 20-clen;t++){
                    newss[i].push_back(char('A'+(mt()%8)));
                }
            }
            ans.push_back(newss[i]);
        }
    }

    for (auto x:ans){
        for (auto c:x){
            cout << c;
        }
        cout << "\n";
    }

}

// 2021-06-26 16:47:13
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
using namespace std;

// clang-format on

random_device seed_gen;
mt19937 engine(seed_gen());

const int n = 20;
int m;
vector<string> ss;
map<int, vector<int> > mp;

struct Out {
  int a[n][n];
};

void output(Out& out) {
  stringstream buffer;
  rep(i, n) {
    rep(j, n) {
      if (out.a[i][j] == 0) {
        buffer << '.';
      } else {
        buffer << char('A' + out.a[i][j] - 1);
      }
    }
    buffer << '\n';
  }
  cout << buffer.str();
}

bool matched(Out& state, int mi, int si, int sj, int d) {
  bool res = true;
  int di = (d == 1);
  int dj = (d == 0);
  string& s = ss[mi];
  int sz = s.size();
  rep(idx, sz) {
    int ti = (si + di * idx) % n;
    int tj = (sj + dj * idx) % n;
    res &= (s[idx] - 'A' + 1 == state.a[ti][tj]);
  }
  return res;
}

int calc(Out& state) {
  int c = 0;
  rep(mi, m) {
    bool ok = false;
    rep(si, n) {
      rep(sj, n) {
        rep(d, 2) {
          ok |= matched(state, mi, si, sj, d);
          if (ok) break;
        }
        if (ok) break;
      }
      if (ok) break;
    }
    c += ok;
  }
  double score = double(1e8) * c / m;
  if (c == m) {
    int d = 0;
    rep(i, n) rep(j, n) d += state.a[i][j] == 0;
    score *= 2 * n * n;
    score /= 2 * n * n - d;
  }
  return int(round(score));
}

void init() {
  int n_;
  cin >> n_ >> m;
  ss.resize(m);
  rep(i, m) {
    cin >> ss[i];
    mp[-ss[i].size()].push_back(i);
  }
}

const double TL = 2.955;
double normalized_time() { return double(clock()) / CLOCKS_PER_SEC / TL; }

void answer() {
  init();
  Out ans, state;
  rep(i, n) rep(j, n) ans.a[i][j] = 0;
  int score = 0;
  while (1) {
    double t = normalized_time();
    if (t >= 1.0) break;
    rep(i, n) rep(j, n) state.a[i][j] = 0;
    for (auto& [k, v] : mp) {
      int sz = -k;
      shuffle(ALL(v), engine);
      for (auto mi : v) {
        int mxsi = -1, mxsj = -1, mxd = -1, mx = -1;
        rep(si, n) {
          rep(sj, n) {
            rep(d, 2) {
              int cur = 0;
              bool ok = true;
              rep(idx, sz) {
                int ti = (si + idx * (d == 1)) % n;
                int tj = (sj + idx * (d == 0)) % n;
                if (state.a[ti][tj] == ss[mi][idx] - 'A' + 1) {
                  cur++;
                } else if (state.a[ti][tj] > 0) {
                  ok = false;
                  break;
                }
              }
              if (ok && mx < cur) {
                mx = cur;
                mxsi = si;
                mxsj = sj;
                mxd = d;
              }
            }
          }
        }
        if (mx >= 0) {
          rep(idx, sz) {
            int ti = (mxsi + idx * (mxd == 1)) % n;
            int tj = (mxsj + idx * (mxd == 0)) % n;
            state.a[ti][tj] = ss[mi][idx] - 'A' + 1;
          }
        }
      }
    }
    int prev = score;
    score = calc(state);
    if (prev < score) {
      ans = state;
    } else {
      score = prev;
    }
  }
  output(ans);
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}


#include<bits/stdc++.h>
#define eps 1e-9
#define pii pair<double,double>
#define mp make_pair
using namespace std;
const int N=200005;
pii dp[N],sum;
int n,m,k;
bool in[N];
pii operator -(const pii &a,const pii &b)
{
	return mp(a.first-b.first,a.second-b.second);
}
pii operator +(const pii &a,const pii &b)
{
	return mp(a.first+b.first,a.second+b.second);
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1,x;i<=k;++i)
	{
		scanf("%d",&x);
		in[x]=1;
	}
	sum=mp(0,0);
	for(int i=n-1;i>=0;--i)
	{
		if(in[i])dp[i]=mp(1,0);
		else dp[i]=mp(sum.first/m,sum.second/m+1);
		sum=sum+dp[i]-dp[i+m];
	}
	if(abs(dp[0].first-1)<=eps)printf("-1");
	else printf("%.4lf",dp[0].second/(1-dp[0].first));
	return 0;
}

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

typedef long long ll;

int main() {
    ll N, M, K, A;
    cin >> N >> M >> K;
    vector<bool> start(N + 1, false);
    rep(i, K) {
        cin >> A;
        start[A] = true;
    }
    double L = 0, R = 1e20;
    vector<double> dp(N + 1 + M, 0);
    rep(i, 100) {
        double m = (L + R) / 2, s = 0;
        rep(j, N) {
            if (start[N - 1 - j]) {
                dp[N - 1 - j] = m;
            } else {
                dp[N - 1 - j] = 1 + s / M;
            }
            s += dp[N - 1 - j];
            if (j >= M - 1) s -= dp[N - 1 - j + M];
            //cout << "s=" << s << " ";
        }
        if (dp[0] > m) L = m;
        else R = m;
        //rep(i, N + 1) cout << dp[i] << " "; cout << "\n";
        //cout << L << " " << R << "\n";
    }
    if (dp[0] > 1e15) cout << "-1\n";
    else cout << fixed << setprecision(20) << dp[0] << "\n";
}


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

#define int long long

int32_t main() {
    int N;cin>>N;
    vector<pair<int,int>>points(N);

    // taking points
    for(int i=0,x,y;i<N;i++){
        cin>>x>>y;
        points[i].first = x;
        points[i].second = y;
    }

    int m;cin>>m;
    vector<pair<int,int>>op(m);

    // taking operations

    for(int i=0;i<m;i++){
        cin>>op[i].first;
        if(op[i].first > 2) cin>>op[i].second;
    }

    int q;cin>>q;
    vector<pair<pair<int,int>,int>>queries(q);

    for(int i=0;i<q;i++){
        cin>>queries[i].first.first>>queries[i].first.second;
        queries[i].second = i;
    }

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

    vector<pair<int,int>>ans(q);
    int idx = 0 , sx = 1 , sy = 1 , a = 0 , b = 0 ;
    bool swapped = 0;

    for(int i=0;i<q;i++){
        while(idx < queries[i].first.first) {
            if(op[idx].first == 1){
                swap(sx, sy);
                swap(a,b);
                swapped ^= 1;
                sy = -sy;
                b = -b;
            }
            else if(op[idx].first == 2){
                swap(sx, sy);
                swap(a, b);
                swapped ^= 1;
                sx = -sx;
                a = -a;
            }
            else if(op[idx].first == 3){
                a = 2*op[idx].second - a;
                sx = -sx;
            }
            else{
                b = 2 * op[idx].second - b;
                sy = -sy;
            }
            idx++;
        }

        int id = queries[i].second;
        int p_id = queries[i].first.second - 1;

        if(swapped){
            ans[id] = {points[p_id].second*sx + a , points[p_id].first*sy + b};
        }
        else{
            ans[id] = {points[p_id].first*sx + a , points[p_id].second * sy + b};
        }

    }

    for(auto p : ans) {
        cout<<p.first<<" "<<p.second<<endl;
    }

}


#include <bits/stdc++.h>
#define maxn 300001
using namespace std;
typedef long long LL;

int n;
LL ans;
int ar[maxn];
int tree[maxn];

void update(int x) {
	while(x <= n) {
		tree[x]++;
		x += (x&(-x));
	}
}

int query(int x) {
	int sum = 0;
	while(x) {
		sum += tree[x];
		x -= (x&(-x));
	}
	return sum;
}

int main() {
	scanf("%d",&n);
	for( int i = 1 ; i <= n ; i++ ) {
		scanf("%d",&ar[i]);
		update(++ar[i]);
		ans += i - query(ar[i]);
	}
	printf("%lld ",ans);
	for( int i = 1 ; i < n ; i++ ) {
		ans += n+1 - 2*ar[i];
		printf("%lld ",ans);
	}
	return 0;
}

// Author:   old_school
// Created:  30.01.2021 17:30:27

#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
using namespace std;
#define lld               long long int
#define ld                long double
#define pb                push_back
#define ppb               pop_back
#define mp                make_pair
#define F                 first
#define S                 second
#define nl                '\n'
#define all(c)            (c).begin(),(c).end()
#define rall(c)           (c).rbegin(),(c).rend()
#define sz(c)             (c).size()
#define tr(x,a)           for(auto &a : x)
#define psnt(x,a)         (x).find(a)!=(x).end()
#define vpsnt(x,a)        find(all(x),a)!=(x).end()
#define MOD               1000000007
#define tod               1
#define pi                3.1415926536
#define itr(i,a,b)        for(lld i=a;i<=b;i++)
#define itrn(i,a,b)       for(lld i=a;i>=b;i--)
#define iot(n)            for(lld i=0;i<n;i++)
#define pls(n,arr)        lld arr[n]; iot(n)  cin>>arr[i];
#define bye               fflush(stdout)

typedef pair<lld,lld>     pii;
typedef pair<string,lld>  psi;

template <typename T>
bool mycomp(T x,T y){
   return (x==y);  //give your condition here
}
bool paircomp(const pair<lld,lld> &x,const pair<lld,lld> &y){
return x.second<y.second;
}
lld _mergeSort(lld arr[], lld temp[],
                 lld left, lld right);
lld merge(lld arr[], lld temp[], lld left,
                   lld mid, lld right);
lld mergeSort(lld arr[], lld array_size)
{
    lld temp[array_size];
    return _mergeSort(arr, temp, 0, array_size - 1);
}
lld _mergeSort(lld arr[], lld temp[],
                 lld left, lld right)
{
    lld mid, inv_count = 0;
    if (right > left) {

        mid = (right + left) / 2;

        inv_count += _mergeSort(arr, temp,
                                left, mid);
        inv_count += _mergeSort(arr, temp,
                             mid + 1, right);

        inv_count += merge(arr, temp, left,
                           mid + 1, right);
    }
    return inv_count;
}

lld merge(lld arr[], lld temp[], lld left,
          lld mid, lld right)
{
    lld i, j, k;
    lld inv_count = 0;

    i = left;
    j = mid;
    k = left;
    while ((i <= mid - 1) && (j <= right)) {
        if (arr[i] <= arr[j]) {
            temp[k++] = arr[i++];
        }
        else {
            temp[k++] = arr[j++];

            inv_count = inv_count + (mid - i);
        }
    }

    while (i <= mid - 1)
        temp[k++] = arr[i++];

    while (j <= right)
        temp[k++] = arr[j++];

    for (i = left; i <= right; i++)
        arr[i] = temp[i];

    return inv_count;
}
void solve(){
	lld n; cin>>n;
	pls(n,a);
	lld b[n];
	iot(n) b[i]=a[i];
    lld ans = mergeSort(a, n);
    cout<<ans<<nl;
    iot(n-1){
    	ans+=(n-2*b[i]-1);
    	cout<<ans<<nl;
    }
}
int main(){
       ios_base::sync_with_stdio(false);
             cin.tie(0);
            cout.tie(0);
      lld t=1;// cin>>t;
      while(t--){
            solve();
            cout<<endl;
      }
}