#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <sstream>
#include <cassert>
using namespace std;

typedef long long ll;

const ll INF=1000000000LL*1000000000LL;

struct point
{
	ll x,y;
	point(ll x=0, ll y=0):x(x),y(y){}
	point operator+(const point& p) const
	{
		return point(x+p.x, y+p.y);
	}
	point operator-(const point& p) const
	{
		return point(x-p.x, y-p.y);
	}
	point rot() const
	{
		return point(y,-x);
	}
	ll inner(const point& p) const
	{
		return x*p.x + y*p.y;
	}
	ll cross(const point& p) const
	{
		return x*p.y - y*p.x;
	}
	ll norm2() const
	{
		return x*x+y*y;
	}
	//lexicographical
	bool cmp(const point& p) const
	{
		if(y!=p.y) return y<p.y;
		return x<p.x;
	}

	//polar
	bool operator<(const point& p) const
	{
		bool down1=this->cmp(point(0,0));
		bool down2=p.cmp(point(0,0));
		if(down1!=down2)
			return down1>down2;
		return this->cross(p)>0;
	}
	bool operator==(const point& p) const
	{
		return this->cross(p)==0 && this->inner(p)>0;
	}
	bool operator!=(const point& p) const
	{
		return !((*this)==p);
	}
};

struct Event
{
	point p;
	// 0 - add
	// 1 - query
	// 2 - rem
	int type;
	Event(point p=point(), int type=0):
		p(p),
		type(type)
	{}
	bool operator<(const Event& ev) const
	{
		if(p!=ev.p)
			return p<ev.p;
		return type<ev.type;
	}
};

int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		int n;
		scanf("%d",&n);
		vector<point> p(n);
		set<pair<int,int> > used;
		for(int i=0;i<n;i++)
			scanf("%lld%lld",&p[i].x, &p[i].y);
		
		ll res=ll(n)*(n-1)*(n-2)/6;
		ll bad=0;
		
		vector<point> v;
		vector<Event> ev;
		for(int i=0;i<n;i++)
		{
			v.clear();
			ev.clear();

			for(int j=0;j<n;j++)
				if(i!=j)
					v.push_back(p[j]-p[i]);

			point sample(-2000000001,1);
			int cnt=0;
			for(int j=0;j+1<n;j++)
			{
				point c=v[j];
				ev.push_back(Event(c, 1));
				point A, B;
				A=c.rot();
				B=A.rot().rot();
				if(B<A)
					swap(A,B);
				bool present=v[j].inner(sample)<=0;
				if(present)
				{
					cnt++;
					ev.push_back(Event(A,2));
					ev.push_back(Event(B,0));
				}
				else
				{
					ev.push_back(Event(A,0));
					ev.push_back(Event(B,2));
				}
			}
			
			sort(ev.begin(), ev.end());
			for(const Event & e: ev)
			{
				if(e.type==1)
					bad+=cnt;
				else if(e.type==0)
					cnt++;
				else
					cnt--;
			}
		}
		res-=bad/2;
		cout<<res<<endl;
	}
	return 0;
}
