unittest
{
	assert( [ "2", "1 1", "2 2" ].parse.expand.solve == 1 );
	assert( [ "3", "1 4", "4 6", "7 8" ].parse.expand.solve == 1 );
	assert( [ "4", "1 1", "1 2", "2 1", "2 2" ].parse.expand.solve == 2 );
	
	assert( [ "5", "1 5", "3 4", "5 3", "7 2", "2 1" ].parse.expand.solve == 2 );		// 追加ケース
}



import std.conv;
import std.container;
import std.math;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	auto xys = new long[ 2 ][ n ];
	foreach( ref xy; xys )
	{
		input.popFront;
		xy = input.front.split.to!( long[] );
	}
	return tuple( xys );
}

auto solve( long[ 2 ][] xys )
{
	// xのペアの増分とyのペアの増分を計算
	long[ long ] dxs;
	long[ long ] dys;
	foreach( i, xy_a; xys )
	{
		foreach( xy_b; xys[ i + 1 .. $ ] )
		{
			dxs[ ( xy_b[ 0 ] - xy_a[ 0 ] ).abs ]++;
			dys[ ( xy_b[ 1 ] - xy_a[ 1 ] ).abs ]++;
		}
	}
	
	// xのペアで一番多かった増分を検索
	auto p  = 0L;
	auto pc = 0L;
	foreach( d, c; dxs )
	{
		if( c <= pc ) continue;
		p = d;
		pc = c;
	}
	
	// yのペアで一番多かった増分を検索
	auto q  = 0L;
	auto qc = 0L;
	foreach( d, c; dys )
	{
		if( c <= qc ) continue;
		q = d;
		qc = c;
	}
	
	// コストを計算
	auto ans = 0L;
	DList!( long[ 2 ] ) queue;
	while( !xys.empty )
	{
		ans++;
		queue.insertBack( xys.front );
		xys.popFront;
		
		while( !queue.empty )
		{
			auto ab = queue.front;
			queue.removeFront;
			foreach_reverse( i, xy; xys )
			{
				if( ( ab[ 0 ] - p == xy[ 0 ] || ab[ 0 ] + p == xy[ 0 ] ) &&
				    ( ab[ 1 ] - q == xy[ 1 ] || ab[ 1 ] + q == xy[ 1 ] ) )
				{
					queue.insertBack( xy );
					xys = xys[ 0 .. i ] ~ xys[ i + 1 .. $ ];
				}
			}
		}
	}
	return ans;
}
