#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];
int b1[700010],c1[700010],d1[30],e1[30];
bool v[1000000010],v1[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 (!v1[y[i]]) {
v1[y[i]]=1;
b1[++cnt]=y[i];
c1[cnt]=1;
if (1>=maxx) {
if (1==maxx) l++;
else l=1;
d1[l]=y[i];
maxx=1;
}
}
else {
for (int j=1;j<=cnt;j++)
if (b1[j]==y[i]) {
c1[j]++;
if (c1[j]>=maxx) {
if (c1[j]==maxx) l++;
else l=1;
d1[l]=y[i];
maxx=c1[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));
}