#include <iostream>


using namespace std;
#include <math.h>
#include <stdio.h>
int main()
{
    double n;
    cin >> n;

    double x1, y1;
    cin >> x1 >> y1;

    double x2, y2;
    cin >> x2 >> y2;

    double x3, y3;
    cin >> x3 >> y3;

    double x4, y4;
    cin >> x4 >> y4;

    double jedandva2 = (x1-y1) * (x1-y1) + (x2-y2) * (x2-y2);
    double jedantri2 = (x1-y1)*(x1-y1) + (x3-y3)*(x3-y3);
    double jedancetiri2 = (x1-y1)*(x1-y1) + (x4-y4)*(x4-y4);
    double dvatri2 = (x2-y2)*(x2-y2) + (x3-y3)*(x3-y3);
    double dvacetiri2 = (x2-y2)*(x2-y2) + (x4-y4)*(x4-y4);
    double tricetiri2 = (x3-y3)*(x3-y3) + (x4-y4)*(x4-y4);

    double jedandva = sqrt (jedandva2);
    double jedantri = sqrt (jedantri2);
    double jedancetiri = sqrt (jedancetiri2);
    double dvatri = sqrt (dvatri2);
    double dvacetiri = sqrt (dvacetiri2);
    double tricetiri = sqrt (tricetiri2);

    if (x1 == x2 && x3 == x4)
    {
        if (jedandva == 2 * tricetiri || 2 * jedandva == tricetiri)
        {
            cout << "1";
            return 0;
        }
        else
        {
            cout << "0";
            return 0;
        }
    }
    else if (x1 == x3 && x2 == x4)
    {
        if (jedantri == 2 * dvacetiri || 2 * jedantri == dvacetiri)
        {
            cout << "1";
            return 0;
        }
        else
        {
            cout << "0";
            return 0;
        }
    }
    else if (x1 == x4 && x2 == x3)
    {
        if (jedancetiri == 2 * dvatri || 2 * jedancetiri == dvatri)
        {
            cout << "1";
            return 0;
        }
        else
        {
            cout << "0";
            return 0;
        }
    }


    else if (y1 == y2 && y3 == y4)
    {
        if (jedandva == 2 * tricetiri || 2 * jedandva == tricetiri)
        {
            cout << "1";
            return 0;
        }
        else
        {
            cout << "0";
            return 0;
        }
    }
    else if (y1 == y3 && y2 == y4)
    {
        if (jedantri == 2 * dvacetiri || 2 * jedantri == dvacetiri)
        {
            cout << "1";
            return 0;
        }
        else
        {
            cout << "0";
            return 0;

        }
    }
    else if (y1 == y4 && y2 == y3)
    {
        if (jedancetiri == 2 * dvatri || 2 * jedancetiri == dvatri)
        {
            cout << "1";
            return 0;
        }
        else
        {
            cout << "0";
            return 0;
        }
    }
    else
    {
        cout << "0";
        return 0;
    }
}