import java.util.*;

public class geode {
	public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        for (int cc = 0; cc < t; ++cc) {
            int n = scan.nextInt();
            pt[] pts = new pt[n];
            for (int i = 0; i < n; ++i) {
                int x = scan.nextInt(), y = scan.nextInt();
                pts[i] = new pt(x, y);
            }
            int ans = 0;
            while (n >= 3) {
                int refIndex = getIndexMin(pts, n);
                pt.refX = pts[refIndex].x;
                pt.refY = pts[refIndex].y;
                
                n = grahamScan(pts, n);
                // System.out.println("debug "+n);
                // for (int j = 0; j < n; ++j) {
                //     System.out.println("point "+pts[j].x+" "+pts[j].y);
                // }
                ++ans;
            }
            System.out.println(ans);
        }
        scan.close();
	}
	
	// Returns the point in pts with minimum y breaking tie by minimum x.
	public static int getIndexMin(pt[] pts, int n) {
		int res = 0;
		for (int i=1; i<n; i++)
			if (pts[i].y < pts[res].y || (pts[i].y == pts[res].y && pts[i].x < pts[res].x))
				res = i;
		return res;
	}
	
	public static int grahamScan(pt[] pts, int n) {
// 	public static double grahamScan(pt[] pts, int n) {

		// Sort the points by angle with reference point.
		Arrays.sort(pts, 0, n);

		// Push first two points on.
		Stack<pt> myStack = new Stack<pt>();
		myStack.push(pts[0]);
		myStack.push(pts[1]);

		// Go through the rest of the points.
		for (int i=2; i<n; i++) {

			// Get last three pts.
			pt cur = pts[i];
			pt mid = myStack.pop();
			pt prev = myStack.pop();

			// Pop off the left turns.
			while (!prev.isRightTurn(mid, cur)) {
				mid = prev;
				prev = myStack.pop();
			}

			// Push back the last right turn.
			myStack.push(prev);
			myStack.push(mid);
			myStack.push(cur);
		}

        // List<pt> hullPoints = new ArrayList<>(myStack);
        // hullPoints.add(hullPoints.get(0)); // Close the hull
        
        // int res = n-myStack.size();

		// Add up distances around the hull.
// 		double res = 0;
// 		pt cur = pts[0];
// 		while (myStack.size() > 0) {
// 			pt next = myStack.pop();
// 			res += cur.dist(next);
// 			cur = next;
// 		}
        // for (int i = 0, j = n-1; i < res; ++i) {
        //     pt next = myStack.pop();
        //     while (next == pts[j]) {
        //         --j;
        //     }
        //     pts[i] = pts[j--];
        // }
        Set<pt> set = new HashSet<>();
        while (myStack.size() > 0) {
            set.add(myStack.pop());
        }
        int res = 0;
        for (int i = 0; i < n; ++i) {
            if (!set.contains(pts[i])) {
                pts[res++] = pts[i];
            }
        }
// 		Return.
		return res;
	}
}

class pt implements Comparable<pt> {

	// Stores reference pt
	public static long refX;
	public static long refY;

	public long x;
	public long y;

	public pt(long myx, long myy) {
		x = myx;
		y = myy;
	}

	// Returns the vector from this to other.
	public pt getVect(pt other) {
		return new pt(other.x-x, other.y-y);
	}

	// Returns the distance between this and other.
	public double dist(pt other) {
		return Math.sqrt((other.x-x)*(other.x-x) + (other.y-y)*(other.y-y));
	}

	// Returns the magnitude ot this cross product other.
	public long crossProductMag(pt other) {
		return this.x*other.y - other.x*this.y;
	}

	// returns true iff this to mid to next is a right turn (180 degree is considered right turn).
	public boolean isRightTurn(pt mid, pt next) {
		pt v1 = getVect(mid);
		pt v2 = mid.getVect(next);
		return v1.crossProductMag(v2) >= 0; /*** Change to > 0 to skip collinear points. ***/
	}

	// Returns true iff this pt is the origin.
	public boolean isZero() {
		return x == 0 && y == 0;
	}

	public int compareTo(pt other) {

		pt myRef = new pt(refX, refY);
		pt v1 = myRef.getVect(this);
		pt v2 = myRef.getVect(other);

		// To avoid 0 issues.
		if (v1.isZero()) return -1;
		if (v2.isZero()) return 1;

		// Angles are different, we are going counter-clockwise here.
		if (v1.crossProductMag(v2) < 0) return 1;
		if (v1.crossProductMag(v2) > 0) return -1;

		// This should work, smaller vectors come first.
		if (myRef.dist(v1) < myRef.dist(v2)) return -1;
		return 1;
	}
}