#include<bits/stdc++.h>
#define maxn 700000
using namespace std;
int n,k;
int ans=100000;
struct node
{
int data,v;
}a[maxn];
inline const void read(int &a)
{
a=0;
char c=getchar();
while(c<'0'||c>'9') c=getchar();
while(c<='9'&&c>='0')
{
a=(a<<1)+(a<<3)+c-'0';
c=getchar();
}
}
bool com(node aa,node bb)
{
return aa.data<bb.data;
}
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int x1,x2;
read(n);
if(n%2==0)
k=n/2;
else k=n/2+1;
for(int i=0;i<n;i++)
{
read(x1);read(x2);
if(x1==x2)
a[i*2].v=3,a[i*2+1].v=4;
else a[i*2].v=1,a[i*2+1].v=2;
a[i*2].data=x1;
a[i*2+1].data=x2;
}
sort(a,a+2*n,com);
int temp=1,step=0;
if(a[0].v==1)
step=1;
for(int i=1;i<=2*n;i++)
{
if(a[i].data==a[i-1].data)
{
if(a[i].v!=4)
temp++;
if(a[i].v==1||a[i].v==3)
step++;
}
else {
if(temp>=k)
if(ans>k-step)
{
ans=k-step;
}
if(a[i].v!=4)
temp=1;
else temp=0;
if(a[i].v==1||a[i].v==3)
step=1;
else step=0;
}
}
if(ans!=100000)
cout<<ans<<endl;
else cout<<"Impossible"<<endl;
return 0;
}