#include <bits/stdc++.h>
using namespace std;
map<int,int>f1;
map<int,int>f2;
map<int,int>f3;
int n;
int main()
{
// freopen("card.in","r",stdin);
// freopen("card.out","w",stdout);
int x,y;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d %d",&x,&y);
f1[x]++;
f1[y]++;
f2[x]++;
}
int m=(n+1)/2,b=0;
for(int i=1;i<=n;i++)
{
if(f1[i]>=m)
b=1;
}
if(b==0)
{
printf("Impossible");
return 0;
}
int minn=1e9;
for(int i=1;i<=n;i++)
{
if(f1[i]>=m)
f3[i]=m-f2[i];
else
f3[i]=1e9;
minn=min(minn,f3[i]);
// cout<<f[i].x<<' '<<f[i].y<<' '<<f[i].z<<endl;
}
printf("%d",minn);
return 0;
}