#include <bits/stdc++.h>
using namespace std;

bool dalije(int a1,int a2,int b1,int b2,int c1,int c2,int d1,int d2)
{
    int r1=a1-b1;
    int r2=a2-b2;
    int r3=c1-d1;
    int r4=c2-d2;
    if(((abs(r1)/abs(r2))==(abs(r3)/abs(r4))) && ( (r1*r1+r2*r2)/(r3*r3+r4*r4)==2 || (r3*r3+r4*r4)/(r1*r1+r2*r2)==2 ) )
        return true;
    else
        return false;
}
int main()
{
    int n;
    cin>>n;
    int ax,ay,bx,by,cx,cy,dx,dy;
    cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;
    if( (dalije(ax,ay,bx,by,cx,cy,dx,dy) || (bx,by,cx,cy,ax,ay,dx,dy) || (ax,ay,cx,cy,bx,by,dx,dy) ) )
        cout<<"1";
    else
        cout<<"0";
    return 0;
}