//
/*
Author : Zmonarch
Knowledge :
*/
#include <bits/stdc++.h>
#define inf 2147483647
#define int long long
using namespace std ;
const int N = 1e6 + 10 ;
int read() {
int x = 0 , f = 1 ; char ch = getchar() ;
while(!isdigit(ch)) {if(ch == '-') f = - 1 ; ch = getchar() ;}
while( isdigit(ch)) {x = x * 10 + ch - '0' ; ch = getchar() ;}
return x * f ;
}
int n , m , tot , Ans = inf ;
bool tag ;
map <int , int> cnt1 , cnt2 ;
int a[N] , b[N] , num[N];
signed main() {
// freopen("card.in" , "r" , stdin) ;
// freopen("card.out" , "w" , stdout) ;
n = read() ;
for(int i = 1 ; i <= n ; i++)
{
a[i] = read() , b[i] = read() ;
if(a[i] ^ b[i]) cnt1[a[i]]++ , cnt2[b[i]]++;
else cnt1[a[i]]++ ;
num[++tot] = a[i] ; num[++tot] = b[i] ;
}
sort(num + 1 , num + tot + 1) ;
for(int i = 1 ; i <= n ; i++)
{
int kx = cnt1[a[i]] , ky = cnt2[a[i]] ;
if(kx + ky >= (n + 1) / 2) tag = 1 , Ans = min(Ans , max(0ll , (n + 1) / 2 - kx)) ;
}
if(tag) printf("%lld\n" , Ans) ;
else printf("Impossible\n") ;
//fclose(stdin) ; fclose(stdout) ;
return 0 ;
}