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

//type
//------------------------------------------
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;

//REPEAT
//------------------------------------------
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(), (a).end()
#define PRINT(V)     \
  for (auto v : (V)) \
  cout << v << " "
#define SORT(V) sort((V).begin(), (V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
#define SZ(x) ((int)(x).size())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

//math
//------------------------------------------
int QP(int a, int b)
{
  int ans = 1;
  do
  {
    if (b & 1)
      ans = 1ll * ans * a % MOD;
    a = 1ll * a * a % MOD;
  } while (b >>= 1);
  return ans;
}
int QP(int a, int b, int MOD)
{
  int ans = 1;
  do
  {
    if (b & 1)
      ans = 1ll * ans * a % MOD;
    a = 1ll * a * a % MOD;
  } while (b >>= 1);
  return ans;
}
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

//debug
//------------------------------------------
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
ll N, K;
//main
//------------------------------------------


signed main()
{
  cin>>N;
  cout<<N-1<<endl;
  return 0;
}
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define manytests int TT;cin >> TT; while (TT--)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORd(i,a,b) for (int i = (a); i >= (b); --i)

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

#define ll long long
#define ld long double
#define fi first
#define se second
#define rev reverse

#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define vd vector<double>
#define vs vector<string>
#define vld vector<ld>
#define vb vector<bool>
#define vvi vector<vi>
#define pii pair<int, int>
#define pl pair<ll, ll>
#define pld pair<ld, ld>
#define vpi vector<pii>
#define vpl vector<pl>
#define vpld vector<pld>

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a-d, b-c) << "\n";

    return 0;
}
