#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<double ,double> > points,equations;
vector<double> infinite_slope;
//points will contain x-cordinate and y-cordinate
//equations will contain m & c [ y= m*x +c ]
//infinite slope cannot be stored in equations without making some valid assumptions,
//so we are storing the y-coordinate in another vector
#define LL long long int
void get_input()
{
cin>>n;
points.resize(n);
int i;
for(i=0;i<n;i++)
cin>>points[i].first>>points[i].second;
}
void make_equations()
{
//converts points to equations
int i,j,count;
//number of equations will be nC2 i.e. n*(n-1)/2
count=n*(n-1)/2;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
double x1,y1,x2,y2,m,c;
x1=points[i].first;
y1=points[i].second;
x2=points[j].first;
y2=points[j].second;
if(x1==x2)
{
infinite_slope.push_back(y1);
}
else
{
m=(y2-y1)/(x2-x1);
c=y1-m*x1;
equations.push_back(make_pair(m,c));
}
}
}
}
LL get_n_from_nC2(LL x)
{
//for a given nC2, calculates value of n
LL ans=(LL)sqrt(2*x);
ans++;
return ans;
}
LL calculate(LL x)
{
//for a given nC2 calculates value of nC3
LL count=get_n_from_nC2(x);
LL ans=(count*(count-1)*(count-2))/6;
return ans;
}
LL number_of_triangles()
{
make_equations();
sort(equations.begin(),equations.end());
sort(infinite_slope.begin(),infinite_slope.end());
/*
Total Triangles possible -> nC3
But all triangles that lie on a straight line have zero areas ,
so those need to be subtracted from the total
*/
LL total=(n*(n-1)*(n-2))/6,count=1;
int i;
for(i=1;i<equations.size();i++)
{
if(equations[i].first==equations[i-1].first && equations[i].second==equations[i-1].second)
{
count++;
}
else
{
total-=calculate(count);
count=1;
}
}
total-=calculate(count);
count=1;
for(i=1;i<infinite_slope.size();i++)
{
if(infinite_slope[i]==infinite_slope[i-1] &&
infinite_slope[i]==infinite_slope[i-1])
{
count++;
}
else
{
//this count is actuallly nC2
total-=calculate(count);
count=1;
}
}
total-=calculate(count);
return total;
}
void display_equations()
{
cout<<"\n\n ***\t\t***\n\n Equations -->\n\n";
int i;
for(i=0;i<equations.size();i++)
{
cout<<equations[i].first<<"\t"<<equations[i].second<<endl;
}
}
int main()
{
get_input();
cout<<number_of_triangles()<<endl;
//display_equations();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBuOwp2ZWN0b3I8cGFpcjxkb3VibGUgLGRvdWJsZT4gPiBwb2ludHMsZXF1YXRpb25zOwp2ZWN0b3I8ZG91YmxlPiBpbmZpbml0ZV9zbG9wZTsKLy9wb2ludHMgd2lsbCBjb250YWluIHgtY29yZGluYXRlIGFuZCB5LWNvcmRpbmF0ZQovL2VxdWF0aW9ucyB3aWxsIGNvbnRhaW4gbSAmIGMgWyB5PSBtKnggK2MgXQovL2luZmluaXRlIHNsb3BlIGNhbm5vdCBiZSBzdG9yZWQgaW4gZXF1YXRpb25zIHdpdGhvdXQgbWFraW5nIHNvbWUgdmFsaWQgYXNzdW1wdGlvbnMsCi8vc28gd2UgYXJlIHN0b3JpbmcgdGhlIHktY29vcmRpbmF0ZSBpbiBhbm90aGVyIHZlY3RvcgojZGVmaW5lIExMIGxvbmcgbG9uZyBpbnQKdm9pZCBnZXRfaW5wdXQoKQp7CgljaW4+Pm47Cglwb2ludHMucmVzaXplKG4pOwoJaW50IGk7Cglmb3IoaT0wO2k8bjtpKyspCgkJY2luPj5wb2ludHNbaV0uZmlyc3Q+PnBvaW50c1tpXS5zZWNvbmQ7Cn0JCnZvaWQgbWFrZV9lcXVhdGlvbnMoKQp7CgkvL2NvbnZlcnRzIHBvaW50cyB0byBlcXVhdGlvbnMKCWludCBpLGosY291bnQ7CgkvL251bWJlciBvZiBlcXVhdGlvbnMgd2lsbCBiZSBuQzIgaS5lLiBuKihuLTEpLzIKCWNvdW50PW4qKG4tMSkvMjsKCWZvcihpPTA7aTxuO2krKykKCXsKCQlmb3Ioaj1pKzE7ajxuO2orKykKCQl7CgkJCWRvdWJsZSB4MSx5MSx4Mix5MixtLGM7CgkJCXgxPXBvaW50c1tpXS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