//card
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=3e5+5;
int n,a[N],b[N],x[N<<1],cnt,ans,sum,m,t;
signed main(){
//freopen("card.in","r",stdin);
//freopen("card.out","w",stdout);
scanf("%lld",&n),ans=n+1,m=(n+1)>>1;
for(int i=1;i<=n;i++){
scanf("%lld%lld",&a[i],&b[i]);
x[++cnt]=a[i];
if(a[i]!=b[i]) x[++cnt]=b[i];
}
sort(x+1,x+cnt+1);
for(int i=1;i<=cnt;i++){
if(x[i]==x[i-1]){
++sum;
if(sum==m){
t=0;
for(int j=1;j<=n;j++)
if(a[j]==x[i]) t++;
t=min(t,m),ans=min(ans,m-t);
}
}
else sum=1;
}
if(ans>n) printf("Impossible\n");
else printf("%lld\n",ans);
return 0;
}