#include <bits/stdc++.h>
#define amfetamin ios_base::sync_with_stdio(false); cin.tie(NULL); cerr.tie(NULL); cout.tie(NULL);
using namespace std;
int a1, a2, b1, b2;
int main() {
amfetamin
cin >> a1 >> a2 >> b1 >> b2;
if (a1 == b1 or a2 == b2) {
    cout << 2 << endl;
    return 0;
} else cout << 1 << endl;



return 0;
}