#include<bits/stdc++.h>
using namespace std;
int Left[ 301000 ] , Right[ 301000 ],mid[ 301000 ];
int a , b , n , MIN= 0x7777777 , MAX = -0x77777777 , ans = MIN;
int main(){
// freopen("card.in","r",stdin);
// freopen("card.out","w",stdout);
scanf("%d",&n);
for( int i = 1; i <= n ; i ++){
scanf("%d%d", &a , &b );
MIN = min(MIN , min( a , b ));
MAX = max(MAX , max( a , b ));
Left[ a ] ++ ;
Right[ b ] ++ ;
mid[ a ]++;
mid[ b ]++;
if( a == b ) mid [ a ] -- ;
}
// for ( int i = MIN ; i <= MAX ; i ++ )
// cout << Left[ i ] << " "<< Right[ i ] <<" "<<mid[ i ]<<" "<<i<<endl;
int least = ( n + 1 ) / 2;
for( int i = MIN ; i <= MAX ; i ++ ) {
// int L = least - Left[ i ] , R = least - Right[ i ];
// cout<<L << " "<<R <<" "<<i <<endl;
if( mid[ i ] >= least )
ans = min( ans , min( least - Left[ i ] , least - Right[ i ]));
}
if( ans < 0 ) ans = 0;
if(ans == 0x7777777 )printf("Impossible");else
printf("%d",ans);
return 0;
}