#!/usr/bin/env python3 import sys MOD = 998244353 def main(): a,b,c,d=map(int, input().split()) if abs(a - c) + abs(b - d) <= 3: print(1) elif a == c or b == d: print(1) else: print(2) return if __name__ == '__main__': main()