#pragma region template // clang-format off #if __has_include() #include // precompiled header #endif #if (defined __INTELLISENSE__) && (!defined PROPER) #define NDEBUG namespace std { #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if (defined __INTELLISENSE__) && (!defined PROPER) using namespace std; } #endif #ifdef LOCAL_DEBUG #include // https://gist.github.com/naskya/2c5c84dbc8f70a2e5680b4267fff1af5 #define see(...) debugger::print(#__VA_ARGS__, __VA_ARGS__) #define here(label) debugger::output << "[Debug] " << #label << (std::string(#label).empty() ? "" : " | ") << "line " << __LINE__ << " (" << __func__ << ")\n" #define trace(label, ...) do {here(label); see(__VA_ARGS__);} while(0) #define com(msg) debugger::output << "[Debug] " << msg << "\n" #define local(x) do {x} while(0) #define alter(x, y) x #else #define see(...) (static_cast(0)) #define here(label) (static_cast(0)) #define trace(label, ...) (static_cast(0)) #define com(msg) (static_cast(0)) #define local(x) (static_cast(0)) #define alter(x, y) y #endif #if (!defined LOCAL_DEBUG) || (defined NOWARN) #define warn(msg) (static_cast(0)) #else #define warn(msg) debugger::output << "[Warning] " << msg << "\n" #endif #if (defined LOCAL_DEBUG) || (defined LOCAL_NDEBUG) || (defined __INTELLISENSE__) #define NOEXCEPT #define M_assert(expr) assert(expr) #define O_assert(expr) assert(expr) #else #define NOEXCEPT noexcept #define M_assert(expr) do {if(__builtin_expect(!(expr), 0)) {long long *p = (long long*) std::malloc(1 << 30); for (int i = 0; i < static_cast((1 << 30) / sizeof(long long)); p[i] = 1, i += (1 << 9)); std::fprintf(stderr, "%lld", *p);}} while(0) #define O_assert(expr) do {if(__builtin_expect(!(expr), 0)) for(int i = 0; i < (1 << 24); i++) std::puts("Hello, world!");} while(0) #endif #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define rng(i, f, t, s) for (int i = (f); ((s) > 0) ? (i < (int)(t)) : (i > (int)(t)); i += (s)) #define erng(i, f, t, s) for (int i = (f); ((s) > 0) ? (i <= (int)(t)) : (i >= (int)(t)); i += (s)) [[maybe_unused]] constexpr int INF = 1000000005; [[maybe_unused]] constexpr long long LINF = 1000000000000000005LL; [[maybe_unused]] constexpr double EPS = 1e-9; [[maybe_unused]] constexpr long double LEPS = 1e-14L; [[maybe_unused]] constexpr int dy[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0}; [[maybe_unused]] constexpr int dx[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0}; template > constexpr V Min(const S a, const T b, const U... c) { if constexpr (sizeof...(U)) return std::min((V) a, (V) Min(b, c...)); else return std::min((V) a, (V) b); } template > constexpr V Max(const S a, const T b, const U... c) { if constexpr (sizeof...(U)) return std::max((V) a, (V) Max(b, c...)); else return std::max((V) a, (V) b); } // clang-format on #pragma endregion void solve() { int a, b, c, d; std::cin >> a >> b >> c >> d; c -= a; d -= b; c = (c < 0) ? -c : c; d = (d < 0) ? -d : d; if (c == 0 && d == 0) std::cout << 0 << "\n"; else if (c == 0 || d == 0 || (c + d) <= 3) std::cout << 1 << "\n"; else std::cout << 2 << "\n"; } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); solve(); }