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.algorithm;
import std.conv;
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 )
{
	xys.sort();
	
	// ペアの増分を計算
	long[ long[ 2 ] ] ds;
	foreach( i, xy_a; xys )
	{
		foreach( xy_b; xys[ i + 1 .. $ ] )
		{
			ds[ [ xy_b[ 0 ] - xy_a[ 0 ], xy_b[ 1 ] - xy_a[ 1 ] ] ]++;
		}
	}
	
	// 一番多かったペアの増分を検索
	auto pq  = [ 0L, 0L ];
	auto pqc = 0L;
	foreach( d, c; ds )
	{
		if( c <= pqc ) continue;
		pq[] = d;
		pqc = c;
	}
	
	// コストを計算
	auto uft = UnionFind( xys.length );
	foreach( i, xy_a; xys )
	{
		foreach( j, xy_b; xys[ i + 1 .. $ ].enumerate( i + 1 ) )
		{
			if( ( xy_a[ 0 ] - pq[ 0 ] == xy_b[ 0 ] && xy_a[ 1 ] - pq[ 1 ] == xy_b[ 1 ] ) ||
			    ( xy_a[ 0 ] + pq[ 0 ] == xy_b[ 0 ] && xy_a[ 1 ] + pq[ 1 ] == xy_b[ 1 ] ) )
			{
				uft.unite( i, j );
			}
		}
	}
	return uft.rootnum;
}

// UnionFind木
struct UnionFind
{
	private long   num;
	private long[] ps;
	
	public this( long n )
	{
		num = n;
		ps = new long[]( n );
		ps[] = -1;
	}
	
	public long root( long x )
	{
		return ( ps[ x ] < 0 ) ? x : ( ps[ x ] = root( ps[ x ] ) );
	}
	
	public bool same( long x, long y )
	{
		return root( x ) == root( y );
	}
	
	public void unite( long x, long y )
	{
		x = root( x );
		y = root( y );
		if( x == y ) return;
		if( ps[ x ] < ps[ y ] ){ ps[ x ] += ps[ y ]; ps[ y ] = x; }
		else                   { ps[ y ] += ps[ x ]; ps[ x ] = y; }
		num--;
	}
	
	public long rootnum()
	{
		return num;
	}
}
