#include<bits/stdc++.h>
using namespace std;
const int N=300005;
int n,cnt=0;
int ans_cs,sum,m;
int a[N],b[N],c[2*N];
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[i],&b[i]);
c[++cnt]=a[i];
if(a[i]!=b[i]) c[++cnt]=b[i];
}
sort(c+1,c+cnt+1);
sum=0;
m=(n+1)/2;
ans_cs=n+1;
for(int i=1;i<=cnt;i++){
if(c[i]==c[i-1]){
sum++;
if(sum==m){
int cs=0;
for(int j=1;j<=n;j++)
if(a[j]==c[i]) cs++;
cs=min(cs,m);
ans_cs=min(ans_cs,m-cs);
}
}else{
sum=1;
if(sum==m){
ans_cs=0;
break;
}
}
}
if(ans_cs>n) printf("Impossible");
else printf("%d",ans_cs);
return 0;
}