#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	a = a % MOD;
	while (b > 0) {
		if (b & 1) {res = (res * a) % MOD; b--;}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}

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

int main() {
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin >> n;
	ll ans = 1e17;
	vector <pair<ll, ll>> v(n);
	for (auto &i : v)
		cin >> i.ff >> i.ss;
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < n; j++) {
			if (i == j)
				ans = min(ans, v[i].ff + v[i].ss);
			else
				ans = min(ans, max(v[i].ff, v[j].ss));
		}
	}
	cout << ans;
}

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

using namespace std;

// typdef
typedef long long ll;
typedef unsigned long long ull;

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

#define IN_VEC(v)                                                              \
  for (auto &&e : v)                                                           \
  cin >> e
#define MOD 1000000007

#define MP make_pair
#define PB push_back

template <typename T> void print_vector(vector<T> v, string sep = " ") {
  REP(i, v.size()) {
    if (i != 0) {
      cout << sep;
    }
    cout << v[i];
  }
  cout << "\n";
}

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

  // Enter code here
  unsigned long long N;
  std::cin >> N;
  std::set<ull> nums;

  for (ull a = 2; a <= sqrt(N); a++) {
    for (ull i = 2; N >= pow(a, i); i++) {
      nums.insert(pow(a, i));
    }
  }

  cout << N - nums.size() << "\n";
  return 0;
}