#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>

//using namespace __gnu_pbds;
using namespace std;

#define sz(x)                 (int)(x).size()
#define all(x)                (x).begin(), (x).end()
#define tr(x, it)             for(auto (it) = (x).begin();it != (x).end();it++)
#define fo(i, k, n)           for(int i = (k);i < (n);i++)
#define Fo(i, k, n)           for(int i = (k);i >= (n);i--)
#define el                    "\n"
#define ff                    first
#define ss                    second
#define ll                    long long
#define pb                    push_back
#define mp                    make_pair
#define pii                   pair<int, int>
#define vi                    vector<int>
#define mii                   map<int, int>
//#define pqb                   priority_queue<int>
//#define pqs                   priority_queue<int, vi, greater<int>>
//#define pc(x)                 putchar(x);
//#define setbits(x)            __builtin_popcountll(x)
//#define zrobits(x)            __builtin_ctzll(x)
#define mod                   1000000007
#define inf                   1e18
#define deb(x)                cout<<#x<< " = "<< x<<"\n";
//#define ps(x, y)              fixed<<setprecision(y)<<x
//#define mk(arr, n, type)      type *arr = new type[n];
//#define w(x)                  int x; cin>>x; while(x--)

void solve(){
	int n;  
	cin>>n;
	double ar[n][2];
	fo(i, 0, n){
		cin>>ar[i][0]>>ar[i][1];
	} 
	ll ans = 0;
	fo(i, 0, n){
		fo(j, i+1, n){
			double k = (ar[j][1] - ar[i][1])/(ar[j][0] - ar[i][0]);
			if(k <= 1 && k >= -1){
				ans++;
			}
		}
	}
	cout<<ans;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t = 1;
    // cin>>t;
    while(t--){
        solve();
        cout<<el;
    }
    return 0;
}
#include <bits/stdc++.h>
 
//#include <atcoder/modint>
 
 
#define inc(i, n) for (int i = 0; i < (n); i++)
#define incs(i, s, n) for (int i = (s); i < (n); i++)
 
#define yes printf("Yes\n")
#define no printf("No\n")
 
 
using namespace std;
//using mint = atcoder::modint998244353;
using pii = pair<int, int>;
using ll = long long;
 
const int ARR_SIZE = 2e5+5;
const double epsilon = 1e-8;

char arr[ARR_SIZE];
 
int main(int argc, char const *argv[])
{   
    scanf("%s", arr);

    int cnts[10];
    memset(cnts, 0, sizeof cnts);
    int arrLen = strlen(arr);

    if (arrLen == 1) {
        if(arr[0] == '8') {
            yes;
            return 0;
        }
        no;
        return 0;
    }

    if (arrLen == 2) {
        char narr[3] = {0};
        narr[0]=arr[1], narr[1]=arr[0];

        if (stoi(arr)%8==0 || stoi(narr)%8==0) {
            yes;
            return 0;
        }

        no;
        return 0;
    }

    inc(i, arrLen) {
        cnts[arr[i]-'0']++;
    }
    
    int ncnts[10];
    for (int i = 104; i < 1000; i += 8) {
        int num = i;
        memcpy(ncnts, cnts, sizeof cnts);

        bool flag = true;
        while(num > 0) {
            if(--ncnts[num%10] < 0) {
                flag = false;
                break;
            }
            num/=10;
        }
        if (flag) {
            yes;
            return 0;
        }
    }

    for (int i = 104; i < 1000; i += 8) {
        int num = i;
        memcpy(ncnts, cnts, sizeof cnts);

        bool flag = true;
        while(num > 0) {
            if(--ncnts[num%10] < 0) {
                flag = false;
                break;
            }
            num/=10;
        }
        if (flag) {
            yes;
            return 0;
        }
    }

    no;
    return 0;
}