// Arup Guha
// 5/11/2016
// Solution to USACO 2016 Silver February Problem: Load Balancing

import java.util.*;
import java.io.*;

public class balancing {

	public static void main(String[] args) throws Exception {

		// Read in data.
		BufferedReader stdin = new BufferedReader(new FileReader("balancing.in"));
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		int n = Integer.parseInt(tok.nextToken());

		TreeSet<Integer> critY = new TreeSet<Integer>();

		// Read in where the cows are and store the critical Y values.
		pt[] cows = new pt[n];
		for (int i=0; i<n; i++) {
			tok = new StringTokenizer(stdin.readLine());
			int x =	Integer.parseInt(tok.nextToken());
			int y = Integer.parseInt(tok.nextToken());
			cows[i] = new pt(x,y);
			critY.add(y);
		}

		// Sort the cows.
		Arrays.sort(cows);

		int res = Integer.MAX_VALUE;

		// Try placing the x line after each pt.
		for (int i=0; i<n-1; i++) {

			// Try each useful cut.
			for (int cut: critY) {

				// Count cows in bottom left.
				int left = 0;
				for (int j=0; j<=i; j++)
					if (cows[j].y <= cut)
						left++;

				// And bottom right.
				int right = 0;
				for (int j=i+1; j<n; j++)
					if (cows[j].y <= cut)
						right++;

				// Now, take the max of the "4 quadrants"
				int cur = Math.max(left, right);
				cur = Math.max(cur, i+1-left);
				cur = Math.max(cur, n-i-1-right);

				// Update...
				res = Math.min(res, cur);
			}
		}

		// Write result.
		PrintWriter out = new PrintWriter(new FileWriter("balancing.out"));
		out.println(res);
		out.close();
		stdin.close();
	}
}

class pt implements Comparable<pt> {

	public int x;
	public int y;

	public pt(int myx, int myy) {
		x = myx;
		y = myy;
	}

	public int compareTo(pt other) {
		return this.x - other.x;
	}

}