#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
int main(){
vector<pii> a(4);
for(int i = 0 ; i < 4; i ++ ){
cin >> a[i].fi >> a[i].se;
}
sort(a.begin(), a.end());
do{
for(int m = 0 ; m < (1 << 4); m ++ ){
vector<pii> b = a;
for(int i = 0 ;i < 4; i ++ ){
if((m & (1 << i))){
swap(b[i].fi, b[i].se);
}
}
if(b[0].fi + b[1].fi == b[1].se && b[1].se == b[0].se + b[3].se && b[2].se == b[3].se && b[0].fi == b[2].fi + b[3].fi){
cout << "1\n";
return 0;
}
if(b[1].se + b[2].se == b[0].se + b[3].se && b[1].fi == b[2].fi && b[0].fi == b[3].fi && b[2].fi + b[3].fi == b[1].se + b[2].se){
cout << "1\n";
return 0;
}
if(b[0].se + b[1].se == b[3].se && b[0].fi == b[1].fi && b[2].fi == b[1].fi + b[3].fi && b[2].fi == b[2].se + b[3].se){
cout << "1\n"
return 0;
}
}
}while(next_permutation(a.begin(), a.end()));
cout << "0\n";
return 0;
}