#include<bits/stdc++.h>
using namespace std;
int n,l,cnt,need,maxx,x[300010],y[300010];
int b[700010],c[700010],d[30],e[30];
bool v[1000000010];
int main()
{
// freopen("card.in","r",stdin);
// freopen("card.out","w",stdout);
scanf("%d",&n);
need=(n+1)/2;
for (int i=1;i<=n;i++) {
scanf("%d%d",&x[i],&y[i]);
if (!v[x[i]]) {
v[x[i]]=1;
b[++cnt]=x[i];
c[cnt]=1;
if (1>=maxx) {
if (1==maxx) l++;
else l=1;
d[l]=x[i];
maxx=1;
}
}
else {
for (int j=1;j<=cnt;j++)
if (b[j]==x[i]) {
c[j]++;
if (c[j]>=maxx) {
if (c[j]==maxx) l++;
else l=1;
d[l]=x[i];
maxx=c[j];
}
break;
}
}
if (!v[y[i]]) {
v[y[i]]=1;
b[++cnt]=y[i];
c[cnt]=1;
if (1>=maxx) {
if (1==maxx) l++;
else l=1;
d[l]=y[i];
maxx=1;
}
}
else {
for (int j=1;j<=cnt;j++)
if (b[j]==y[i]) {
c[j]++;
if (c[j]>=maxx) {
if (c[j]==maxx) l++;
else l=1;
d[l]=y[i];
maxx=c[j];
}
break;
}
}
}
if (maxx<need) {
puts("Impossible");
return 0;
}
maxx=0;
for (int i=1;i<=n;i++)
for (int j=1;j<=l;j++)
if (x[i]==d[j]) {
e[j]++;
maxx=max(maxx,e[j]);
}
printf("%d",max(0,need-maxx));
}