#include <bits/stdc++.h>
using namespace std;
struct xxx
{
int x,y,z;
}f[10000000005];
int n;
int main()
{
int x,y;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d %d",&x,&y);
f[x].x++;
f[y].x++;
f[x].y++;
}
int m=(n+1)/2,b=0;
for(int i=1;i<=n;i++)
{
if(f[i].x>=m)
b=1;
}
if(b==0)
{
printf("Impossible");
return 0;
}
int minn=1e9;
for(int i=1;i<=n;i++)
{
if(f[i].x>=m)
f[i].z=m-f[i].y;
else
f[i].z=1e9;
minn=min(minn,f[i].z);
// cout<<f[i].x<<' '<<f[i].y<<' '<<f[i].z<<endl;
}
printf("%d",minn);
return 0;
}