import java.io.*;
import java.math.*;
import java.util.*;
import java.util.*;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;
public class Main {
	static BufferedReader bf;
	static PrintWriter pw;
	static FastScanner in;

	static final int MAXN = (int) 1e5+100;
	static int n, ans=0;
	static HashMap <Integer, Pair> hm = new HashMap <Integer,Pair>();
	static HashSet < Integer > hs = new HashSet<Integer>();

	static int x[] = new int [MAXN];
	static int y[] = new int [MAXN];

	public static void main(String[] args) throws Exception{
		bf = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(System.out);
		in = new FastScanner(bf);

		n = in.nextInt();
		int mid = (n+1)/2;
		for (int i=1; i<=n; i++) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
		}

		for (int i=1; i<=n; i++) {
			if (hm.get(x[i])==null) {
				hm.put(x[i], new Pair(1,0));
			} else {
				Pair p = hm.get(x[i]);
				if ( p.a + p.b>=mid) {
					continue;
				}
				p.a++;

			}
		}

		for (int i=1; i<=n; i++) {
			if (x[i]==y[i]) continue;
			if (hm.get(y[i])==null) {
				hm.put(y[i], new Pair(0,1));
			} else {
				Pair p = hm.get(y[i]);
				if (p.a + p.b>=mid) {
					continue;
				}
				p.b++;
			}
		}

		int min = Integer.MAX_VALUE;
		Iterator it = hm.entrySet().iterator();
		while (it.hasNext()) {
			Map.Entry thisEntry = (Map.Entry) it.next();
			Pair p = (Pair)thisEntry.getValue();
			if (p.b + p.a >=mid) {
				if (p.b<min) {
					min = p.b;
				}
			}
		}
		if (min==Integer.MAX_VALUE) {
			pw.println(-1);
		} else {
		pw.println(min);
		}
		pw.close();
    }
}

class Pair {

	int a;
	int b;

	public Pair (int a,int b) {
		this.a = a;
		this.b = b;
	}
}
class FastScanner {

	BufferedReader reader;
	StringTokenizer strTok;

	public FastScanner(BufferedReader reader) {
		this.reader = reader;
	}

	public String nextToken() throws IOException {
		while (strTok == null || !strTok.hasMoreTokens()) {
			strTok = new StringTokenizer(reader.readLine());
		}
		return strTok.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.*;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;
public class Main {
	static BufferedReader bf;
	static PrintWriter pw;
	static FastScanner in;

	static final int MAXN = (int) 1e5+100;
	static int n, ans=0;
	static HashMap <Integer, Pair> hm = new HashMap <Integer,Pair>();
	static HashSet < Integer > hs = new HashSet<Integer>();

	static int x[] = new int [MAXN];
	static int y[] = new int [MAXN];

	public static void main(String[] args) throws Exception{
		bf = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(System.out);
		in = new FastScanner(bf);

		n = in.nextInt();
		int mid = (n+1)/2;
		for (int i=1; i<=n; i++) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
			hs.add(x[i]);
			hs.add(y[i]);
		}

		for (int i=1; i<=n; i++) {
			if (hm.get(x[i])==null) {
				hm.put(x[i], new Pair(1,0));
			} else {
				Pair p = hm.get(x[i]);
				if ( p.a + p.b>=mid) {
					continue;
				}
				p.a++;

			}
		}

		for (int i=1; i<=n; i++) {
			if (x[i]==y[i]) continue;
			if (hm.get(y[i])==null) {
				hm.put(y[i], new Pair(0,1));
			} else {
				Pair p = hm.get(y[i]);
				if (p.a + p.b>=mid) {
					continue;
				}
				p.b++;
			}
		}

		int min = Integer.MAX_VALUE;
		Iterator it = hs.iterator();
		while (it.hasNext()) {
			Pair  p = hm.get(it.next());
			if (p.b + p.a >=mid) {
				if (p.b<min) {
					min = p.b;
				}
			}
		}
		if (min==Integer.MAX_VALUE) {
			pw.println(-1);
		} else {
		pw.println(min);
		}
		pw.close();
    }
}

class Pair {

	int a;
	int b;

	public Pair (int a,int b) {
		this.a = a;
		this.b = b;
	}
}
class FastScanner {

	BufferedReader reader;
	StringTokenizer strTok;

	public FastScanner(BufferedReader reader) {
		this.reader = reader;
	}

	public String nextToken() throws IOException {
		while (strTok == null || !strTok.hasMoreTokens()) {
			strTok = new StringTokenizer(reader.readLine());
		}
		return strTok.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.*;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;
public class Main {
	static final int MAXN = (int) 1e5+100;
	static int n, ans=0;
	static HashMap <Integer, Pair> hm = new HashMap <Integer,Pair>();
	static HashSet < Integer > hs = new HashSet<Integer>();

	static int x[] = new int [MAXN];
	static int y[] = new int [MAXN];

	public static void main(String[] args) throws Exception{

    	Scanner in = new Scanner (System.in);
		PrintWriter pw = new PrintWriter (System.out);

		n = in.nextInt();
		int mid = (n+1)/2;
		for (int i=1; i<=n; i++) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
			hs.add(x[i]);
			hs.add(y[i]);
		}

		for (int i=1; i<=n; i++) {
			if (hm.get(x[i])==null) {
				hm.put(x[i], new Pair(1,0));
			} else {
				if ((hm.get(x[i]).a + hm.get(x[i]).b)>=mid) {
					continue;
				}
				hm.get(x[i]).a++;

			}
		}

		for (int i=1; i<=n; i++) {
			if (x[i]==y[i]) continue;
			if (hm.get(y[i])==null) {
				hm.put(y[i], new Pair(1,0));
			} else {
				if ((hm.get(y[i]).a + hm.get(y[i]).b)>=mid) {
					continue;
				}
				hm.get(y[i]).b++;
			}
		}

		int min = Integer.MAX_VALUE;
		Iterator it = hs.iterator();
		while (it.hasNext()) {
			Pair  p = hm.get(it.next());
			if (p.b + p.a >=mid) {
				if (p.b<min) {
					min = p.b;
				}
			}
		}
		if (min==Integer.MAX_VALUE) {
			pw.println(-1);
		}
		pw.println(min);

		pw.close();
    }
}

class Pair {

	int a;
	int b;

	public Pair (int a,int b) {
		this.a = a;
		this.b = b;
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.*;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;
public class Main {
	static BufferedReader bf;
	static PrintWriter pw;
	static FastScanner in;

	static final int MAXN = (int) 1e5+100;
	static int n, ans=0;
	static HashMap <Integer, Pair> hm = new HashMap <Integer,Pair>();
	static HashSet < Integer > hs = new HashSet<Integer>();

	static int x[] = new int [MAXN];
	static int y[] = new int [MAXN];

	public static void main(String[] args) throws Exception{
		bf = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(System.out);
		in = new FastScanner(bf);

		n = in.nextInt();
		int mid = (n+1)/2;
		for (int i=1; i<=n; i++) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
			hs.add(x[i]);
			hs.add(y[i]);
		}

		for (int i=1; i<=n; i++) {
			if (hm.get(x[i])==null) {
				hm.put(x[i], new Pair(1,0));
			} else {
				if ((hm.get(x[i]).a + hm.get(x[i]).b)>=mid) {
					continue;
				}
				hm.get(x[i]).a++;

			}
		}

		for (int i=1; i<=n; i++) {
			if (x[i]==y[i]) continue;
			if (hm.get(y[i])==null) {
				hm.put(y[i], new Pair(0,1));
			} else {
				if ((hm.get(y[i]).a + hm.get(y[i]).b)>=mid) {
					continue;
				}
				hm.get(y[i]).b++;
			}
		}

		int min = Integer.MAX_VALUE;
		Iterator it = hs.iterator();
		while (it.hasNext()) {
			Pair  p = hm.get(it.next());
			if (p.b + p.a >=mid) {
				if (p.b<min) {
					min = p.b;
				}
			}
		}
		if (min==Integer.MAX_VALUE) {
			pw.println(-1);
		} else {
		pw.println(min);
		}
		pw.close();
    }
}

class Pair {

	int a;
	int b;

	public Pair (int a,int b) {
		this.a = a;
		this.b = b;
	}
}
class FastScanner {

	BufferedReader reader;
	StringTokenizer strTok;

	public FastScanner(BufferedReader reader) {
		this.reader = reader;
	}

	public String nextToken() throws IOException {
		while (strTok == null || !strTok.hasMoreTokens()) {
			strTok = new StringTokenizer(reader.readLine());
		}
		return strTok.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.*;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;
public class Main {
	static final int MAXN = (int) 1e5+100;
	static int n, ans=0;
	static HashMap <Integer, Pair> hm = new HashMap <Integer,Pair>();
	static HashSet < Integer > hs = new HashSet<Integer>();

	static int x[] = new int [MAXN];
	static int y[] = new int [MAXN];

	public static void main(String[] args) throws Exception{

    	Scanner in = new Scanner (System.in);
		PrintWriter pw = new PrintWriter (System.out);

		n = in.nextInt();
		int mid = (n+1)/2;
		for (int i=1; i<=n; i++) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
			hs.add(x[i]);
			hs.add(y[i]);
		}

		for (int i=1; i<=n; i++) {
			if (hm.get(x[i])==null) {
				hm.put(x[i], new Pair(1,0));
			} else {
				if ((hm.get(x[i]).a + hm.get(x[i]).b)>=mid) {
					continue;
				}
				hm.get(x[i]).a++;

			}
		}

		for (int i=1; i<=n; i++) {
			if (x[i]==y[i]) continue;
			if (hm.get(y[i])==null) {
				hm.put(y[i], new Pair(1,0));
			} else {
				if ((hm.get(y[i]).a + hm.get(y[i]).b)>=mid) {
					continue;
				}
				hm.get(y[i]).b++;
			}
		}

		int min = Integer.MAX_VALUE;
		Iterator it = hs.iterator();
		while (it.hasNext()) {
			Pair  p = hm.get(it.next());
			if (p.b + p.a >=mid) {
				if (p.b<min) {
					min = p.b;
				}
			}
		}

		pw.println(min);

		pw.close();
    }
}

class Pair {

	int a;
	int b;

	public Pair (int a,int b) {
		this.a = a;
		this.b = b;
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.*;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;
public class Main {
	static final int MAXN = (int) 1e5+100;
	static int n, ans=0;
	static HashMap <Integer, Pair> hm = new HashMap <Integer,Pair>();
	static HashSet < Integer > hs = new HashSet<Integer>();

	static int x[] = new int [MAXN];
	static int y[] = new int [MAXN];

	public static void main(String[] args) throws Exception{

    	Scanner in = new Scanner (System.in);
		PrintWriter pw = new PrintWriter (System.out);

		n = in.nextInt();
		int mid = (n+1)/2;
		for (int i=1; i<=n; i++) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
			hs.add(x[i]);
			hs.add(y[i]);
		}

		for (int i=1; i<=n; i++) {
			if (hm.get(x[i])==null) {
				hm.put(x[i], new Pair(1,0));
			} else {
				if ((hm.get(x[i]).a + hm.get(x[i]).b)>=mid) {
					continue;
				}
				hm.get(x[i]).a++;

			}
		}

		for (int i=1; i<=n; i++) {
			if (x[i]==y[i]) continue;
			if (hm.get(y[i])==null) {
				hm.put(y[i], new Pair(1,0));
			} else {
				if ((hm.get(y[i]).a + hm.get(y[i]).b)>=mid) {
					continue;
				}
				hm.get(y[i]).b++;
			}
		}

		int min = Integer.MAX_VALUE;
		Iterator it = hs.iterator();
		while (it.hasNext()) {
			Pair  p = hm.get(it.next());
			if (p.b + p.a >=mid) {
				if (p.b<min) {
					min = p.b;
				}
			}
		}
		if (min==Integer.MAX_VALUE) {
			pw.println(-1);
		} else {
		pw.println(min);
		}
		pw.close();
    }
}

class Pair {

	int a;
	int b;

	public Pair (int a,int b) {
		this.a = a;
		this.b = b;
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.*;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;
public class Main {
	static BufferedReader bf;
	static PrintWriter pw;
	static FastScanner in;

	static final int MAXN = (int) 1e5+100;
	static int n, ans=0;
	static TreeMap <Integer, Pair> hm = new TreeMap <Integer,Pair>();

	static int x[] = new int [MAXN];
	static int y[] = new int [MAXN];

	public static void main(String[] args) throws Exception{
		bf = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(System.out);
		in = new FastScanner(bf);

		n = in.nextInt();
		int mid = (n+1)/2;
		for (int i=1; i<=n; i++) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
		}

		for (int i=1; i<=n; i++) {
			if (!hm.containsKey(x[i])) {
				hm.put(x[i], new Pair(1,0));
			} else {
				Pair p = hm.get(x[i]);
				if ( p.a + p.b>=mid) {
					continue;
				}
				p.a++;

			}
		}

		for (int i=1; i<=n; i++) {
			if (x[i]==y[i]) continue;
			if (!hm.containsKey(y[i])) {
				hm.put(y[i], new Pair(0,1));
			} else {
				Pair p = hm.get(y[i]);
				if (p.a + p.b>=mid) {
					continue;
				}
				p.b++;
			}
		}

		int min = Integer.MAX_VALUE;
		Iterator it = hm.entrySet().iterator();
		while (it.hasNext()) {
			Map.Entry thisEntry = (Map.Entry) it.next();
			Pair p = (Pair)thisEntry.getValue();
			if (p.b + p.a >=mid) {
				if (p.b<min) {
					min = p.b;
				}
			}
		}
		if (min==Integer.MAX_VALUE) {
			pw.println(-1);
		} else {
		pw.println(min);
		}
		pw.close();
    }
}

class Pair {

	int a;
	int b;

	public Pair (int a,int b) {
		this.a = a;
		this.b = b;
	}
}
class FastScanner {

	BufferedReader reader;
	StringTokenizer strTok;

	public FastScanner(BufferedReader reader) {
		this.reader = reader;
	}

	public String nextToken() throws IOException {
		while (strTok == null || !strTok.hasMoreTokens()) {
			strTok = new StringTokenizer(reader.readLine());
		}
		return strTok.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.*;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;
public class Main {
	static final int MAXN = (int) 1e5+100;
	static int n, ans=0;
	static HashMap <Integer, Pair> hm = new HashMap <Integer,Pair>();
	static HashSet < Integer > hs = new HashSet<Integer>();

	static int x[] = new int [MAXN];
	static int y[] = new int [MAXN];

	public static void main(String[] args) throws Exception{

    	Scanner in = new Scanner (System.in);
		PrintWriter pw = new PrintWriter (System.out);

		n = in.nextInt();
		int mid = (n+1)/2;
		for (int i=1; i<=n; i++) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
			hs.add(x[i]);
			hs.add(y[i]);
		}

		for (int i=1; i<=n; i++) {
			if (hm.get(x[i])==null) {
				hm.put(x[i], new Pair(1,0));
			} else {
				if ((hm.get(x[i]).a + hm.get(x[i]).b)>=mid) {
					continue;
				}
				hm.get(x[i]).a++;

			}
		}

		for (int i=1; i<=n; i++) {
			if (x[i]==y[i]) continue;
			if (hm.get(y[i])==null) {
				hm.put(y[i], new Pair(0,1));
			} else {
				if ((hm.get(y[i]).a + hm.get(y[i]).b)>=mid) {
					continue;
				}
				hm.get(y[i]).b++;
			}
		}

		int min = Integer.MAX_VALUE;
		Iterator it = hs.iterator();
		while (it.hasNext()) {
			Pair  p = hm.get(it.next());
			if (p.b + p.a >=mid) {
				if (p.b<min) {
					min = p.b;
				}
			}
		}
		if (min==Integer.MAX_VALUE) {
			pw.println(-1);
		} else {
		pw.println(min);
		}
		pw.close();
    }
}

class Pair {

	int a;
	int b;

	public Pair (int a,int b) {
		this.a = a;
		this.b = b;
	}
}


import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class Start {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Start().run();
    }

    public static void mergeSort(int[] a) {
        mergeSort(a, 0, a.length - 1);
    }

    private static void mergeSort(int[] a, int levtIndex, int rightIndex) {
        final int MAGIC_VALUE = 50;
        if (levtIndex < rightIndex) {
            if (rightIndex - levtIndex <= MAGIC_VALUE) {
                insertionSort(a, levtIndex, rightIndex);
            } else {
                int middleIndex = (levtIndex + rightIndex) / 2;
                mergeSort(a, levtIndex, middleIndex);
                mergeSort(a, middleIndex + 1, rightIndex);
                merge(a, levtIndex, middleIndex, rightIndex);
            }
        }
    }

    private static void merge(int[] a, int levtIndex, int middleIndex,
            int rightIndex) {
        int length1 = middleIndex - levtIndex + 1;
        int length2 = rightIndex - middleIndex;
        int[] levtArray = new int[length1];
        int[] rightArray = new int[length2];
        System.arraycopy(a, levtIndex, levtArray, 0, length1);
        System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
        for (int k = levtIndex, i = 0, j = 0; k <= rightIndex; k++) {
            if (i == length1) {
                a[k] = rightArray[j++];
            } else if (j == length2) {
                a[k] = levtArray[i++];
            } else {
                a[k] = levtArray[i] <= rightArray[j] ? levtArray[i++]
                        : rightArray[j++];
            }
        }
    }

    private static void insertionSort(int[] a, int levtIndex, int rightIndex) {
        for (int i = levtIndex + 1; i <= rightIndex; i++) {
            int current = a[i];
            int j = i - 1;
            while (j >= levtIndex && a[j] > current) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = current;
        }
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    class LOL implements Comparable<LOL> {
        int x;
        int y;

        public LOL(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(LOL o) {
            // return x-o.x; ---->
            return o.x - x; // <----
        }

    }

    void solve() throws IOException {

        int n = readInt();
        int[] a = new int[n];
        int[] b = new int[n];
        TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();

        TreeSet<Integer> set = new TreeSet<Integer>();
        for (int i = 0; i < n; i++) {
            int x = readInt();
            int y = readInt();
            set.add(x);
            set.add(y);
            if (x == y) {
                if (map.containsKey(x)) {
                    map.put(x, 1 + map.get(x));
                } else {
                    map.put(x, 1);
                }
            } else {
                if (map.containsKey(x)) {
                    map.put(x, 1 + map.get(x));
                } else {
                    map.put(x, 1);
                }
                if (map.containsKey(y)) {
                    map.put(y, 1 + map.get(y));
                } else {
                    map.put(y, 1);
                }
            }
            a[i] = x;
            b[i] = y;
        }
        Object[] q = set.toArray();

        int ans = Integer.MAX_VALUE;
        for (int za = 0; za <q.length; za++)
            {
            if (map.get(q[za])< n/2) continue;
            int cur = 0;
            int ololo = (Integer) q[za];
            for (int i = 0; i < n; i++) {
                if (ololo == a[i]){
                    cur++;
                }
            }
            if (cur >=n/2){
                out.print(0);
                return;
            }
    /*      int hur = 0;
            for (int i = 0; i < n; i++){
                if (ololo == b[i]){
                    hur++;
                }
            } */
            ans = min(ans,(n+1)/2-cur);
        }
        if (ans ==Integer.MAX_VALUE){
            out.print(-1);
        }else
        out.print(ans);
    }
}


import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class Start {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Start().run();
    }

    public static void mergeSort(int[] a) {
        mergeSort(a, 0, a.length - 1);
    }

    private static void mergeSort(int[] a, int levtIndex, int rightIndex) {
        final int MAGIC_VALUE = 50;
        if (levtIndex < rightIndex) {
            if (rightIndex - levtIndex <= MAGIC_VALUE) {
                insertionSort(a, levtIndex, rightIndex);
            } else {
                int middleIndex = (levtIndex + rightIndex) / 2;
                mergeSort(a, levtIndex, middleIndex);
                mergeSort(a, middleIndex + 1, rightIndex);
                merge(a, levtIndex, middleIndex, rightIndex);
            }
        }
    }

    private static void merge(int[] a, int levtIndex, int middleIndex,
            int rightIndex) {
        int length1 = middleIndex - levtIndex + 1;
        int length2 = rightIndex - middleIndex;
        int[] levtArray = new int[length1];
        int[] rightArray = new int[length2];
        System.arraycopy(a, levtIndex, levtArray, 0, length1);
        System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
        for (int k = levtIndex, i = 0, j = 0; k <= rightIndex; k++) {
            if (i == length1) {
                a[k] = rightArray[j++];
            } else if (j == length2) {
                a[k] = levtArray[i++];
            } else {
                a[k] = levtArray[i] <= rightArray[j] ? levtArray[i++]
                        : rightArray[j++];
            }
        }
    }

    private static void insertionSort(int[] a, int levtIndex, int rightIndex) {
        for (int i = levtIndex + 1; i <= rightIndex; i++) {
            int current = a[i];
            int j = i - 1;
            while (j >= levtIndex && a[j] > current) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = current;
        }
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    class LOL implements Comparable<LOL> {
        int x;
        int y;

        public LOL(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(LOL o) {
            // return x-o.x; ---->
            return o.x - x; // <----
        }

    }

    void solve() throws IOException {

        int n = readInt();
        int[] a = new int[n];
        int[] b = new int[n];
        TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();

        TreeSet<Integer> set = new TreeSet<Integer>();
        for (int i = 0; i < n; i++) {
            int x = readInt();
            int y = readInt();
            set.add(x);
            set.add(y);
            if (x == y) {
                if (map.containsKey(x)) {
                    map.put(x, 1 + map.get(x));
                } else {
                    map.put(x, 1);
                }
            } else {
                if (map.containsKey(x)) {
                    map.put(x, 1 + map.get(x));
                } else {
                    map.put(x, 1);
                }
                if (map.containsKey(y)) {
                    map.put(y, 1 + map.get(y));
                } else {
                    map.put(y, 1);
                }
            }
            a[i] = x;
            b[i] = y;
        }
        Object[] q = set.toArray();

        int ans = Integer.MAX_VALUE;
        for (int za = 0; za <q.length; za++)
            {
            if (map.get(q[za])< n/2) continue;
            int cur = 0;
            int ololo = (Integer) q[za];
            for (int i = 0; i < n; i++) {
                if (ololo == a[i]){
                    cur++;
                }
            }
            if (cur >=(n+1)/2){
                out.print(0);
                return;
            }
    /*      int hur = 0;
            for (int i = 0; i < n; i++){
                if (ololo == b[i]){
                    hur++;
                }
            } */
            ans = min(ans,(n+1)/2-cur);
        }
        if (ans ==Integer.MAX_VALUE){
            out.print(-1);
        }else
        out.print(ans);
    }
}


import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class Start {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Start().run();
    }

    public static void mergeSort(int[] a) {
        mergeSort(a, 0, a.length - 1);
    }

    private static void mergeSort(int[] a, int levtIndex, int rightIndex) {
        final int MAGIC_VALUE = 50;
        if (levtIndex < rightIndex) {
            if (rightIndex - levtIndex <= MAGIC_VALUE) {
                insertionSort(a, levtIndex, rightIndex);
            } else {
                int middleIndex = (levtIndex + rightIndex) / 2;
                mergeSort(a, levtIndex, middleIndex);
                mergeSort(a, middleIndex + 1, rightIndex);
                merge(a, levtIndex, middleIndex, rightIndex);
            }
        }
    }

    private static void merge(int[] a, int levtIndex, int middleIndex,
            int rightIndex) {
        int length1 = middleIndex - levtIndex + 1;
        int length2 = rightIndex - middleIndex;
        int[] levtArray = new int[length1];
        int[] rightArray = new int[length2];
        System.arraycopy(a, levtIndex, levtArray, 0, length1);
        System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
        for (int k = levtIndex, i = 0, j = 0; k <= rightIndex; k++) {
            if (i == length1) {
                a[k] = rightArray[j++];
            } else if (j == length2) {
                a[k] = levtArray[i++];
            } else {
                a[k] = levtArray[i] <= rightArray[j] ? levtArray[i++]
                        : rightArray[j++];
            }
        }
    }

    private static void insertionSort(int[] a, int levtIndex, int rightIndex) {
        for (int i = levtIndex + 1; i <= rightIndex; i++) {
            int current = a[i];
            int j = i - 1;
            while (j >= levtIndex && a[j] > current) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = current;
        }
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    class LOL implements Comparable<LOL> {
        int x;
        int y;

        public LOL(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(LOL o) {
            // return x-o.x; ---->
            return o.x - x; // <----
        }

    }

    void solve() throws IOException {

        int n = readInt();
        int[] a = new int[n];
        int[] b = new int[n];
        TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();

        TreeSet<Integer> set = new TreeSet<Integer>();
        for (int i = 0; i < n; i++) {
            int x = readInt();
            int y = readInt();
            set.add(x);
            set.add(y);
            if (x == y) {
                if (map.containsKey(x)) {
                    map.put(x, 1 + map.get(x));
                } else {
                    map.put(x, 1);
                }
            } else {
                if (map.containsKey(x)) {
                    map.put(x, 1 + map.get(x));
                } else {
                    map.put(x, 1);
                }
                if (map.containsKey(y)) {
                    map.put(y, 1 + map.get(y));
                } else {
                    map.put(y, 1);
                }
            }
            a[i] = x;
            b[i] = y;
        }
        Object[] q = set.toArray();

        int ans = Integer.MAX_VALUE;
        for (int za = 0; za <q.length; za++)
            {
            if (map.get(q[za])< (n+1)/2) continue;
            int cur = 0;
            int ololo = (Integer) q[za];
            for (int i = 0; i < n; i++) {
                if (ololo == a[i]){
                    cur++;
                }
            }
            if (cur >=(n+1)/2){
                out.print(0);
                return;
            }
    /*      int hur = 0;
            for (int i = 0; i < n; i++){
                if (ololo == b[i]){
                    hur++;
                }
            } */
            ans = min(ans,(n+1)/2-cur);
        }
        if (ans ==Integer.MAX_VALUE){
            out.print(-1);
        }else
        out.print(ans);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class LittleElephantAndCards {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        HashMap<Integer, Integer> front = new HashMap<Integer, Integer>();
        HashMap<Integer, Integer> back = new HashMap<Integer, Integer>();
        TreeSet<Integer> numbers = new TreeSet<Integer>();
        for (int i = 0; i < n; i++) {
            int f = r.nextInt();
            int b = r.nextInt();
            int fVal = front.containsKey(f) ? front.get(f) : 0;
            front.put(f, fVal + 1);
            int bVal = back.containsKey(b) ? back.get(b) : 0;
            if (f != b) {
                back.put(b, bVal + 1);
            }
            numbers.add(f);
            numbers.add(b);
        }
        int min = 1 << 28;
        int half = (n + 1) / 2;
        for (int x : numbers) {
            int needed = Math.max(0,half - (front.get(x) == null ? 0 : front.get(x)));
            if(needed==0)
                min = 0;
            if(back.containsKey(x)&&back.get(x)>=needed){
                min = Math.min(min, needed);
            }
        }
        if(min==1<<28)
            System.out.println(-1);
        else
            System.out.println(min);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

}


import java.awt.Point;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.StringTokenizer;

public class LittleElephantAndCards {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        HashMap<Integer, Integer> front = new HashMap<Integer, Integer>(250000);
        HashMap<Integer, Integer> back = new HashMap<Integer, Integer>(250000);
        HashSet<Integer> numbers = new HashSet<Integer>(250000);
        Point[] arr=new Point[n];
        for (int i = 0; i < n; i++) {
            int f = r.nextInt();
            int b = r.nextInt();
            arr[i]=new Point(f,b);
        }
        Random rand=new Random();
        for(int i=0;i<n;i++){
            int index=rand.nextInt(n);
            Point temp=arr[index];
            arr[index]=arr[i];
            arr[i]=temp;
        }
        for(int i=0;i<n;i++){
            int f=arr[i].x;
            int b=arr[i].y;
            int fVal = front.containsKey(f) ? front.get(f) : 0;
            front.put(f, fVal + 1);
            int bVal = back.containsKey(b) ? back.get(b) : 0;
            if (f != b) {
                back.put(b, bVal + 1);
            }
            numbers.add(f);
            numbers.add(b);
        }
        int min = 1 << 28;
        int half = (n + 1) / 2;
        for (int x : numbers) {
            int needed = Math.max(0,half - (front.get(x) == null ? 0 : front.get(x)));
            if(needed==0)
                min = 0;
            if(back.containsKey(x)&&back.get(x)>=needed){
                min = Math.min(min, needed);
            }
        }
        if(min==1<<28)
            System.out.println(-1);
        else
            System.out.println(min);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class LittleElephantAndCards {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        HashMap<Integer, Integer> front = new HashMap<Integer, Integer>();
        HashMap<Integer, Integer> back = new HashMap<Integer, Integer>();
        HashSet<Integer> numbers = new HashSet<Integer>();
        for (int i = 0; i < n; i++) {
            int f = r.nextInt();
            int b = r.nextInt();
            int fVal = front.containsKey(f) ? front.get(f) : 0;
            front.put(f, fVal + 1);
            int bVal = back.containsKey(b) ? back.get(b) : 0;
            if (f != b) {
                back.put(b, bVal + 1);
            }
            numbers.add(f);
            numbers.add(b);
        }
        int min = 1 << 28;
        int half = (n + 1) / 2;
        for (int x : numbers) {
            int needed = Math.max(0,half - (front.get(x) == null ? 0 : front.get(x)));
            if(back.containsKey(x)&&back.get(x)>=needed){
                min = Math.min(min, needed);
            }
        }
        System.out.println(min);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

}


import java.awt.Point;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.StringTokenizer;

public class LittleElephantAndCards {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        HashMap<Integer, Integer> front = new HashMap<Integer, Integer>(360000);
        HashMap<Integer, Integer> back = new HashMap<Integer, Integer>(360000);
        HashSet<Integer> numbers = new HashSet<Integer>(360000);
        Point[] arr=new Point[n];
        for (int i = 0; i < n; i++) {
            int f = r.nextInt();
            int b = r.nextInt();
            arr[i]=new Point(f,b);
        }
        Random rand=new Random();
        for(int i=0;i<10000;i++){
            int index=rand.nextInt(n);
            Point temp=arr[index];
            arr[index]=arr[i];
            arr[i]=temp;
        }
        for(int i=0;i<n;i++){
            int f=arr[i].x;
            int b=arr[i].y;
            int fVal = front.containsKey(f) ? front.get(f) : 0;
            front.put(f, fVal + 1);
            int bVal = back.containsKey(b) ? back.get(b) : 0;
            if (f != b) {
                back.put(b, bVal + 1);
            }
            numbers.add(f);
            numbers.add(b);
        }
        int min = 1 << 28;
        int half = (n + 1) / 2;
        for (int x : numbers) {
            int needed = Math.max(0,half - (front.get(x) == null ? 0 : front.get(x)));
            if(needed==0)
                min = 0;
            if(back.containsKey(x)&&back.get(x)>=needed){
                min = Math.min(min, needed);
            }
        }
        if(min==1<<28)
            System.out.println(-1);
        else
            System.out.println(min);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class LittleElephantAndCards {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        HashMap<Integer, Integer> front = new HashMap<Integer, Integer>(160000);
        HashMap<Integer, Integer> back = new HashMap<Integer, Integer>(160000);
        HashSet<Integer> numbers = new HashSet<Integer>(160000);
        for (int i = 0; i < n; i++) {
            int f = r.nextInt();
            int b = r.nextInt();
            int fVal = front.containsKey(f) ? front.get(f) : 0;
            front.put(f, fVal + 1);
            int bVal = back.containsKey(b) ? back.get(b) : 0;
            if (f != b) {
                back.put(b, bVal + 1);
            }
            numbers.add(f);
            numbers.add(b);
        }
        int min = 1 << 28;
        int half = (n + 1) / 2;
        for (int x : numbers) {
            int needed = Math.max(0,half - (front.get(x) == null ? 0 : front.get(x)));
            if(needed==0)
                min = 0;
            if(back.containsKey(x)&&back.get(x)>=needed){
                min = Math.min(min, needed);
            }
        }
        if(min==1<<28)
            System.out.println(-1);
        else
            System.out.println(min);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class LittleElephantAndCards {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        HashMap<Integer, Integer> front = new HashMap<Integer, Integer>();
        HashMap<Integer, Integer> back = new HashMap<Integer, Integer>();
        HashSet<Integer> numbers = new HashSet<Integer>();
        for (int i = 0; i < n; i++) {
            int f = r.nextInt();
            int b = r.nextInt();
            int fVal = front.containsKey(f) ? front.get(f) : 0;
            front.put(f, fVal + 1);
            int bVal = back.containsKey(b) ? back.get(b) : 0;
            if (f != b) {
                back.put(b, bVal + 1);
            }
            numbers.add(f);
            numbers.add(b);
        }
        int min = 1 << 28;
        int half = (n + 1) / 2;
        for (int x : numbers) {
            int needed = Math.max(0,half - (front.get(x) == null ? 0 : front.get(x)));
            if(needed==0)
                min = 0;
            if(back.containsKey(x)&&back.get(x)>=needed){
                min = Math.min(min, needed);
            }
        }
        System.out.println(min);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class LittleElephantAndCards {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        HashMap<Integer, Integer> front = new HashMap<Integer, Integer>(250000);
        HashMap<Integer, Integer> back = new HashMap<Integer, Integer>(250000);
        HashSet<Integer> numbers = new HashSet<Integer>(250000);
        for (int i = 0; i < n; i++) {
            int f = r.nextInt();
            int b = r.nextInt();
            int fVal = front.containsKey(f) ? front.get(f) : 0;
            front.put(f, fVal + 1);
            int bVal = back.containsKey(b) ? back.get(b) : 0;
            if (f != b) {
                back.put(b, bVal + 1);
            }
            numbers.add(f);
            numbers.add(b);
        }
        int min = 1 << 28;
        int half = (n + 1) / 2;
        for (int x : numbers) {
            int needed = Math.max(0,half - (front.get(x) == null ? 0 : front.get(x)));
            if(needed==0)
                min = 0;
            if(back.containsKey(x)&&back.get(x)>=needed){
                min = Math.min(min, needed);
            }
        }
        if(min==1<<28)
            System.out.println(-1);
        else
            System.out.println(min);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class LittleElephantAndCards {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        TreeMap<Integer, Integer> front = new TreeMap<Integer, Integer>();
        TreeMap<Integer, Integer> back = new TreeMap<Integer, Integer>();
        TreeSet<Integer> numbers = new TreeSet<Integer>();
        for (int i = 0; i < n; i++) {
            int f = r.nextInt();
            int b = r.nextInt();
            int fVal = front.containsKey(f) ? front.get(f) : 0;
            front.put(f, fVal + 1);
            int bVal = back.containsKey(b) ? back.get(b) : 0;
            if (f != b) {
                back.put(b, bVal + 1);
            }
            numbers.add(f);
            numbers.add(b);
        }
        int min = 1 << 28;
        int half = (n + 1) / 2;
        for (int x : numbers) {
            int needed = Math.max(0,half - (front.get(x) == null ? 0 : front.get(x)));
            if(needed==0)
                min = 0;
            if(back.containsKey(x)&&back.get(x)>=needed){
                min = Math.min(min, needed);
            }
        }
        if(min==1<<28)
            System.out.println(-1);
        else
            System.out.println(min);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

}


import java.awt.Point;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.StringTokenizer;

public class LittleElephantAndCards {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        HashMap<Integer, Integer> front = new HashMap<Integer, Integer>(360000);
        HashMap<Integer, Integer> back = new HashMap<Integer, Integer>(360000);
        HashSet<Integer> numbers = new HashSet<Integer>(360000);
        Point[] arr=new Point[n];
        for (int i = 0; i < n; i++) {
            int f = r.nextInt();
            int b = r.nextInt();
            arr[i]=new Point(f,b);
        }
        Random rand=new Random();
        for(int i=0;i<Math.min(n,10000);i++){
            int index=rand.nextInt(n);
            Point temp=arr[index];
            arr[index]=arr[i];
            arr[i]=temp;
        }
        for(int i=0;i<n;i++){
            int f=arr[i].x;
            int b=arr[i].y;
            int fVal = front.containsKey(f) ? front.get(f) : 0;
            front.put(f, fVal + 1);
            int bVal = back.containsKey(b) ? back.get(b) : 0;
            if (f != b) {
                back.put(b, bVal + 1);
            }
            numbers.add(f);
            numbers.add(b);
        }
        int min = 1 << 28;
        int half = (n + 1) / 2;
        for (int x : numbers) {
            int needed = Math.max(0,half - (front.get(x) == null ? 0 : front.get(x)));
            if(needed==0)
                min = 0;
            if(back.containsKey(x)&&back.get(x)>=needed){
                min = Math.min(min, needed);
            }
        }
        if(min==1<<28)
            System.out.println(-1);
        else
            System.out.println(min);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class LittleElephantAndCards {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        HashMap<Integer, Integer> front = new HashMap<Integer, Integer>();
        HashMap<Integer, Integer> back = new HashMap<Integer, Integer>();
        HashSet<Integer> numbers = new HashSet<Integer>();
        for (int i = 0; i < n; i++) {
            int f = r.nextInt();
            int b = r.nextInt();
            int fVal = front.containsKey(f) ? front.get(f) : 0;
            front.put(f, fVal + 1);
            int bVal = back.containsKey(b) ? back.get(b) : 0;
            if (f != b) {
                back.put(b, bVal + 1);
            }
            numbers.add(f);
            numbers.add(b);
        }
        int min = 1 << 28;
        int half = (n + 1) / 2;
        for (int x : numbers) {
            int needed = Math.max(0,half - (front.get(x) == null ? 0 : front.get(x)));
            if(needed==0)
                min = 0;
            if(back.containsKey(x)&&back.get(x)>=needed){
                min = Math.min(min, needed);
            }
        }
        if(min==1<<28)
            System.out.println(-1);
        else
            System.out.println(min);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

}


//package a;

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		int n = nextInt();
		Map<Integer, Integer> f = new TreeMap<Integer, Integer>();
		Map<Integer, Integer> b = new TreeMap<Integer, Integer>();
		Set<Integer> set = new TreeSet<Integer>();

		for(int i=0;i<n;i++){
			int a = nextInt();
			int c = nextInt();
			Integer x = f.get(a);
			if (x == null) f.put(a, 1);
			else f.put(a, x+1);

			if (a != c){
				x = b.get(c);
				if (x == null) b.put(c, 1);
				else b.put(c, x+1);
			}
			set.add(a);set.add(c);
		}
		int ret = -1;
		n = n/2 + n%2;
		for(int i : set){
			int t = 0;
			Integer x = f.get(i);
			if (x != null) t = x;

			if (t >= n){
				System.out.println(0);
				return;
			}else{
				int r = n - t;
				x = b.get(i);
				t = 0;
				if (x != null) t = x;
				if (t >= r){
					if (ret == -1 || ret > r){
						ret = r;
					}
				}
			}
		}
		System.out.println(ret);
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}


//package a;

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		int n = nextInt();
		Map<Integer, Integer> f = new TreeMap<Integer, Integer>();
		Map<Integer, Integer> b = new TreeMap<Integer, Integer>();
		HashSet<Integer> set = new HashSet<Integer>();

		for(int i=0;i<n;i++){
			int a = nextInt();
			int c = nextInt();
			Integer x = f.get(a);
			if (x == null) f.put(a, 1);
			else f.put(a, x+1);

			if (a != c){
				x = b.get(c);
				if (x == null) b.put(c, 1);
				else b.put(c, x+1);
			}
			set.add(a);set.add(c);
		}
		int ret = -1;
		n = n/2 + n%2;
		for(int i : set){
			int t = 0;
			Integer x = f.get(i);
			if (x != null) t = x;

			if (t >= n){
				System.out.println(0);
				return;
			}else{
				int r = n - t;
				x = b.get(i);
				t = 0;
				if (x != null) t = x;
				if (t >= r){
					if (ret == -1 || ret > r){
						ret = r;
					}
				}
			}
		}
		System.out.println(ret);
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}


//package a;

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		//in =  new BufferedReader(new FileReader("input.txt"));
		int n = nextInt();
		pair p[] = new pair[n];
		for(int i=0;i<n;i++){
			p[i] = new pair(nextInt(), nextInt());
		}
		HashMap<Long, Integer> map = new HashMap<Long, Integer>();
		for(int i=0;i<n;i++){
			if (map.containsKey(p[i].a)){
				int t = map.get(p[i].a);
				map.put(p[i].a, t+1);
			}else{
				map.put(p[i].a, 1);
			}
			if (p[i].a != p[i].b){
				if (map.containsKey(p[i].b)){
					int t = map.get(p[i].b);
					map.put(p[i].b, t+1);
				}else{
					map.put(p[i].b, 1);
				}
			}
		}

		int l = n/2 + n%2;
		HashSet<Long> set = new HashSet<Long>();
		for(Long a : map.keySet()){
			int t = map.get(a);
			if (t >= l){
				set.add(a);
			}
		}
		if (set.size() == 0){
			System.out.println(-1);
			return;
		}
		int ret = Integer.MAX_VALUE/2;
		for(Long a : set){
			int already = 0;
			int cnt = 0;
			for(int i=0;i<n;i++){
				if (p[i].a == a){
					already++;
				}
			}
			if (already >= l){
				System.out.println(0);
				return;
			}
			for(int i=0;i<n;i++){
				if (p[i].b == a && p[i].a != a){
					cnt++;
					if (already + cnt >= l) break;
				}
			}
			ret = Math.min(ret, cnt);
		}
		System.out.println((ret == Integer.MAX_VALUE/2 ? -1 : ret));
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}
class pair{
	public long a,b;
	public pair(long a, long b){
		this.a = a;
		this.b = b;
	}
}


//package a;

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		int n = nextInt();
		HashMap<Integer, Integer> f = new HashMap<Integer, Integer>();
		HashMap<Integer, Integer> b = new HashMap<Integer, Integer>();
		HashSet<Integer> set = new HashSet<Integer>();

		for(int i=0;i<n;i++){
			int a = nextInt();
			int c = nextInt();
			if (f.containsKey(a)){
				int t = f.get(a);
				f.put(a, t+1);
			}else{
				f.put(a, 1);
			}

			if (a != c){
				if (b.containsKey(c)){
					int t = b.get(c);
					b.put(c, t+1);
				}else{
					b.put(c, 1);
				}
			}
			set.add(a);set.add(c);
		}
		int ret = -1;
		n = n/2 + n%2;
		for(int i : set){
			int t = 0;
			if (f.containsKey(i))
				t = f.get(i);
			if (t >= n){
				System.out.println(0);
				return;
			}else{
				int r = n - t;
				if (b.containsKey(i)){
					t = b.get(i);
					if (t >= r){
						if (ret == -1 || ret > r){
							ret = r;
						}
					}
				}
			}
		}
		System.out.println(ret);
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}


//package a;

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		int n = nextInt();
		Map<Integer, Integer> f = new TreeMap<Integer, Integer>();
		Map<Integer, Integer> b = new TreeMap<Integer, Integer>();
		HashSet<Integer> set = new HashSet<Integer>();

		for(int i=0;i<n;i++){
			int a = nextInt();
			int c = nextInt();
			if (f.containsKey(a)){
				int t = f.get(a);
				f.put(a, t+1);
			}else{
				f.put(a, 1);
			}

			if (a != c){
				if (b.containsKey(c)){
					int t = b.get(c);
					b.put(c, t+1);
				}else{
					b.put(c, 1);
				}
			}
			set.add(a);set.add(c);
		}
		int ret = -1;
		n = n/2 + n%2;
		for(int i : set){
			int t = 0;
			if (f.containsKey(i))
				t = f.get(i);
			if (t >= n){
				System.out.println(0);
				return;
			}else{
				int r = n - t;
				if (b.containsKey(i)){
					t = b.get(i);
					if (t >= r){
						if (ret == -1 || ret > r){
							ret = r;
						}
					}
				}
			}
		}
		System.out.println(ret);
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}


//package a;

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		//in =  new BufferedReader(new FileReader("input.txt"));
		int n = nextInt();
		pair p[] = new pair[n];
		for(int i=0;i<n;i++){
			p[i] = new pair(nextInt(), nextInt());
		}
		HashMap<Long, Integer> map = new HashMap<Long, Integer>();
		for(int i=0;i<n;i++){
			if (map.containsKey(p[i].a)){
				int t = map.get(p[i].a);
				map.put(p[i].a, t+1);
			}else{
				map.put(p[i].a, 1);
			}
			if (map.containsKey(p[i].b)){
				int t = map.get(p[i].b);
				map.put(p[i].b, t+1);
			}else{
				map.put(p[i].b, 1);
			}
		}
		int l = n/2 + n%2;

		HashSet<Long> set = new HashSet<Long>();
		for(Long a : map.keySet()){
			int t = map.get(a);
			if (t >= l){
				set.add(a);
			}
		}
		if (set.size() == 0){
			System.out.println(-1);
			return;
		}
		int ret = Integer.MAX_VALUE/2;
		for(Long a : set){
			int already = 0;
			int cnt = 0;
			for(int i=0;i<n;i++){
				if (p[i].a == a){
					already++;
				}
			}
			if (already >= l){
				System.out.println(0);
				return;
			}
			for(int i=0;i<n;i++){
				if (p[i].b == a && p[i].a != a){
					cnt++;
					already++;
					if (already >= l) break;
				}
			}
			ret = Math.min(ret, cnt);
		}
		System.out.println((ret == Integer.MAX_VALUE/2 ? -1 : ret));
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}
class pair{
	public long a,b;
	public pair(long a, long b){
		this.a = a;
		this.b = b;
	}
}


//package a;

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		//in =  new BufferedReader(new FileReader("input.txt"));
		int n = nextInt();
		pair p[] = new pair[n];
		for(int i=0;i<n;i++){
			p[i] = new pair(nextInt(), nextInt());
		}
		HashMap<Long, Integer> map = new HashMap<Long, Integer>();
		for(int i=0;i<n;i++){
			if (map.containsKey(p[i].a)){
				int t = map.get(p[i].a);
				map.put(p[i].a, t+1);
			}else{
				map.put(p[i].a, 1);
			}
			if (map.containsKey(p[i].b)){
				int t = map.get(p[i].b);
				map.put(p[i].b, t+1);
			}else{
				map.put(p[i].b, 1);
			}
		}
		int l = n/2 + n%2;

		HashSet<Long> set = new HashSet<Long>();
		for(Long a : map.keySet()){
			int t = map.get(a);
			if (t >= l){
				set.add(a);
			}
		}
		if (set.size() == 0){
			System.out.println(-1);
			return;
		}
		int ret = Integer.MAX_VALUE/2;
		boolean used[] = new boolean[n];
		for(Long a : set){
			Arrays.fill(used, false);
			int already = 0;
			int cnt = 0;
			for(int i=0;i<n;i++){
				if (p[i].a == a){
					already++;
					used[i] = false;
				}
			}
			if (already >= l){
				System.out.println(0);
				return;
			}
			for(int i=0;i<n;i++){
				if (p[i].b == a && !used[i]){
					cnt++;
					already++;
					if (already >= l) break;
				}
			}
			ret = Math.min(ret, cnt);
		}
		System.out.println((ret == Integer.MAX_VALUE/2 ? -1 : ret));
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}
class pair{
	public long a,b;
	public pair(long a, long b){
		this.a = a;
		this.b = b;
	}
}


//package a;

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		//in =  new BufferedReader(new FileReader("input.txt"));
		int n = nextInt();
		pair p[] = new pair[n];
		for(int i=0;i<n;i++){
			p[i] = new pair(nextInt(), nextInt());
		}
		HashMap<Long, Integer> map = new HashMap<Long, Integer>();
		for(int i=0;i<n;i++){
			if (map.containsKey(p[i].a)){
				int t = map.get(p[i].a);
				map.put(p[i].a, t+1);
			}else{
				map.put(p[i].a, 1);
			}
			if (map.containsKey(p[i].b)){
				int t = map.get(p[i].b);
				map.put(p[i].b, t+1);
			}else{
				map.put(p[i].b, 1);
			}
		}
		int l = n/2 + n%2;

		HashSet<Long> set = new HashSet<Long>();
		for(Long a : map.keySet()){
			int t = map.get(a);
			if (t >= l){
				set.add(a);
			}
		}
		if (set.size() == 0){
			System.out.println(-1);
			return;
		}
		int ret = Integer.MAX_VALUE;
		for(Long a : set){
			int already = 0;
			int cnt = 0;
			for(int i=0;i<n;i++){
				if (p[i].a == a)
					already++;
			}
			if (already >= l){
				System.out.println(0);
				return;
			}
			for(int i=0;i<n;i++){
				if (p[i].b == a){
					cnt++;
					already++;
					if (already >= l) break;
				}
			}
			ret = Math.min(ret, cnt);
		}
		System.out.println(ret);
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}
class pair{
	public long a,b;
	public pair(long a, long b){
		this.a = a;
		this.b = b;
	}
}


//package a;

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		int n = nextInt();
		HashMap<Integer, Integer> f = new HashMap<Integer, Integer>();
		HashMap<Integer, Integer> b = new HashMap<Integer, Integer>();
		HashSet<Integer> set = new HashSet<Integer>();

		for(int i=0;i<n;i++){
			int a = nextInt();
			int c = nextInt();
			if (f.containsKey(a)){
				int t = f.get(a);
				f.put(a, t+1);
			}else{
				f.put(a, 1);
			}
			set.add(a);
			if (a != c){
				if (b.containsKey(c)){
					int t = b.get(c);
					b.put(c, t+1);
				}else{
					b.put(c, 1);
				}
				set.add(c);
			}

		}
		int ret = -1;
		n = n/2 + n%2;
		for(int i : set) if (f.containsKey(i)){
			int t = f.get(i);
			if (t >= n){
				System.out.println(0);
				return;
			}else{
				int r = n - t;
				if (b.containsKey(i)){
					t = b.get(i);
					if (t >= r){
						if (ret == -1 || ret > r){
							ret = r;
						}
					}
				}
			}
		}
		System.out.println(ret);
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}


//package a;

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		//in =  new BufferedReader(new FileReader("input.txt"));
		int n = nextInt();
		pair p[] = new pair[n];
		for(int i=0;i<n;i++){
			p[i] = new pair(nextInt(), nextInt());
		}
		HashMap<Long, Integer> map = new HashMap<Long, Integer>();
		for(int i=0;i<n;i++){
			if (map.containsKey(p[i].a)){
				int t = map.get(p[i].a);
				map.put(p[i].a, t+1);
			}else{
				map.put(p[i].a, 1);
			}
			if (map.containsKey(p[i].b)){
				int t = map.get(p[i].b);
				map.put(p[i].b, t+1);
			}else{
				map.put(p[i].b, 1);
			}
		}
		int l = n/2 + n%2;

		HashSet<Long> set = new HashSet<Long>();
		for(Long a : map.keySet()){
			int t = map.get(a);
			if (t >= l){
				set.add(a);
			}
		}
		if (set.size() == 0){
			System.out.println(-1);
			return;
		}
		int ret = Integer.MAX_VALUE/2;
		for(Long a : set){
			int already = 0;
			int cnt = 0;
			for(int i=0;i<n;i++){
				if (p[i].a == a)
					already++;
			}
			if (already >= l){
				System.out.println(0);
				return;
			}
			for(int i=0;i<n;i++){
				if (p[i].b == a){
					cnt++;
					already++;
					if (already >= l) break;
				}
			}
			ret = Math.min(ret, cnt);
		}
		System.out.println((ret == Integer.MAX_VALUE/2 ? -1 : ret));
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}
class pair{
	public long a,b;
	public pair(long a, long b){
		this.a = a;
		this.b = b;
	}
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class D
{
	BufferedReader in;
	PrintStream out;
	StringTokenizer tok;
	public D() throws NumberFormatException, IOException
	{
		in = new BufferedReader(new InputStreamReader(System.in));
		//in = new BufferedReader(new FileReader("in.txt"));
		out = System.out;
		run();
	}
	void run() throws NumberFormatException, IOException
	{
		HashSet<Integer> colors = new HashSet<Integer>();
		HashMap<Integer,Integer> up = new HashMap<Integer,Integer>();
		HashMap<Integer,Integer> total = new HashMap<Integer,Integer>();
		int n = nextInt();
		for(int i = 0; i < n; i++)
		{
			int a = nextInt();
			int b = nextInt();
			if(up.containsKey(a)) up.put(a, up.get(a)+1);
			else up.put(a, 1);
			if(total.containsKey(a)) total.put(a, total.get(a)+1);
			else total.put(a, 1);
			if(a!=b)
			{
				if(total.containsKey(b)) total.put(b, total.get(b)+1);
				else total.put(b, 1);
			}
			colors.add(a);
			colors.add(b);
		}
		int max = 0;
		int best = 0;
		for(Integer color : colors)
		{
			if(total.get(color)>= n/2.0)
			{
				if(up.get(color)>max)
				{
					max = up.get(color);
					best = color;
				}
			}
		}
		if(max>=n/2.0)out.println(0);
		else out.println((n+1)/2-max);
	}
	public static void main(String[] args) throws NumberFormatException, IOException
	{
		new D();
	}
	String nextToken() throws IOException
	{
		if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());
		return tok.nextToken();
	}
	int nextInt() throws NumberFormatException, IOException
	{
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws NumberFormatException, IOException
	{
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws NumberFormatException, IOException
	{
		return Double.parseDouble(nextToken());
	}
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class D
{
    BufferedReader in;
    PrintStream out;
    StringTokenizer tok;
    public D() throws NumberFormatException, IOException
    {
        in = new BufferedReader(new InputStreamReader(System.in));
        //in = new BufferedReader(new FileReader("in.txt"));
        out = System.out;
        run();
    }
    void run() throws NumberFormatException, IOException
    {
        HashMap<Integer,Integer> colors = new HashMap<Integer,Integer>();
        int cantColors = 0;
        int n = nextInt();
        int[] up = new int[2*n];
        int[] total = new int[2*n];
        for(int i = 0; i < n; i++)
        {
            int a = nextInt();
            int b = nextInt();
            int a_n = 0;
            if(colors.containsKey(a))
                a_n = colors.get(a);
            else
            {
                a_n = cantColors++;
                colors.put(a, a_n);
            }
            up[a_n]++;
            total[a_n]++;
            if(b!= a)
            {
                int b_n = 0;
                if(colors.containsKey(b))
                    b_n = colors.get(b);
                else
                {
                    b_n = cantColors++;
                    colors.put(b, b_n);
                }
                total[b_n]++;
            }
        }
        int max = -1;
        for(int color = 0; color < cantColors; color++)
        {
            if(total[color] >= n/2.0)
            {
                if(up[color]>max)
                    max = up[color];
            }
        }
        if(max==-1) out.println(-1);
        else if(max >= n/2.0) out.println(0);
        else out.println( (n+1)/2 - max );
    }
    public static void main(String[] args) throws NumberFormatException, IOException
    {
        new D();
    }
    String nextToken() throws IOException
    {
        if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());
        return tok.nextToken();
    }
    int nextInt() throws NumberFormatException, IOException
    {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws NumberFormatException, IOException
    {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws NumberFormatException, IOException
    {
        return Double.parseDouble(nextToken());
    }
}


import java.io.BufferedReader;

public class D
{
    BufferedReader in;
    PrintStream out;
    StringTokenizer tok;
    public D() throws NumberFormatException, IOException
    {
        in = new BufferedReader(new InputStreamReader(System.in));
        //in = new BufferedReader(new FileReader("in.txt"));
        out = System.out;
        run();
    }
    void run() throws NumberFormatException, IOException
    {
        HashMap<Integer,Integer> colors = new HashMap<Integer,Integer>();
        int cantColors = 0;
        int n = nextInt();
        int[] up = new int[2*n];
        int[] total = new int[2*n];
        for(int i = 0; i < n; i++)
        {
            int a = nextInt();
            int b = nextInt();
            int a_n = 0;
            if(colors.containsKey(a))
                a_n = colors.get(a);
            else
            {
                a_n = cantColors++;
                colors.put(a, a_n);
            }
            up[a_n]++;
            total[a_n]++;
            if(b!= a)
            {
                int b_n = 0;
                if(colors.containsKey(b))
                    b_n = colors.get(b);
                else
                {
                    b_n = cantColors++;
                    colors.put(b, b_n);
                }
                total[b_n]++;
            }
        }
        int max = -1;
        for(int color = 0; color < cantColors; color++)
        {
            if(total[color] >= n/2.0)
            {
                if(up[color]>max)
                    max = up[color];
            }
        }
        if(max==-1) out.println(-1);
        else if(max >= n/2.0) out.println(0);
        else out.println( (n+1)/2 - max );
    }
    public static void main(String[] args) throws NumberFormatException, IOException
    {
        new D();
    }
    String nextToken() throws IOException
    {
        if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());
        return tok.nextToken();
    }
    int nextInt() throws NumberFormatException, IOException
    {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws NumberFormatException, IOException
    {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws NumberFormatException, IOException
    {
        return Double.parseDouble(nextToken());
    }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class D
{
    BufferedReader in;
    PrintStream out;
    StringTokenizer tok;
    public D() throws NumberFormatException, IOException
    {
        in = new BufferedReader(new InputStreamReader(System.in));
        //in = new BufferedReader(new FileReader("in.txt"));
        out = System.out;
        run();
    }
    void run() throws NumberFormatException, IOException
    {
        HashSet<Integer> colors = new HashSet<Integer>();
        HashMap<Integer,Integer> up = new HashMap<Integer,Integer>();
        HashMap<Integer,Integer> total = new HashMap<Integer,Integer>();
        int n = nextInt();
        for(int i = 0; i < n; i++)
        {
            int a = nextInt();
            int b = nextInt();
            if(up.containsKey(a)) up.put(a, up.get(a)+1);
            else up.put(a, 1);
            if(total.containsKey(a)) total.put(a, total.get(a)+1);
            else total.put(a, 1);
            if(a!=b)
            {
                if(total.containsKey(b)) total.put(b, total.get(b)+1);
                else total.put(b, 1);
            }
            colors.add(a);
            colors.add(b);
        }
        int max = -1;
        int best = 0;
        for(Integer color : colors)
        {
            if(total.get(color)>= n/2.0)
            {
                if(up.get(color)>max)
                {
                    max = up.get(color);
                    best = color;
                }
            }
        }
        if(max==-1) out.println(-1);
        if(max>=n/2.0)out.println(0);
        else out.println((n+1)/2-max);
    }
    public static void main(String[] args) throws NumberFormatException, IOException
    {
        new D();
    }
    String nextToken() throws IOException
    {
        if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());
        return tok.nextToken();
    }
    int nextInt() throws NumberFormatException, IOException
    {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws NumberFormatException, IOException
    {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws NumberFormatException, IOException
    {
        return Double.parseDouble(nextToken());
    }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class D
{
    BufferedReader in;
    PrintStream out;
    StringTokenizer tok;
    public D() throws NumberFormatException, IOException
    {
        in = new BufferedReader(new InputStreamReader(System.in));
        //in = new BufferedReader(new FileReader("in.txt"));
        out = System.out;
        run();
    }
    void run() throws NumberFormatException, IOException
    {
        TreeMap<Integer,Integer> colors = new TreeMap<Integer,Integer>();
        int cantColors = 0;
        int n = nextInt();
        int[] up = new int[2*n];
        int[] total = new int[2*n];
        for(int i = 0; i < n; i++)
        {
            int a = nextInt();
            int b = nextInt();
            int a_n = 0;
            if(colors.containsKey(a))
                a_n = colors.get(a);
            else
            {
                a_n = cantColors++;
                colors.put(a, a_n);
            }
            up[a_n]++;
            total[a_n]++;
            if(b!= a)
            {
                int b_n = 0;
                if(colors.containsKey(b))
                    b_n = colors.get(b);
                else
                {
                    b_n = cantColors++;
                    colors.put(b, b_n);
                }
                total[b_n]++;
            }
        }
        int max = -1;
        for(int color = 0; color < cantColors; color++)
        {
            if(total[color] >= n/2.0)
            {
                if(up[color]>max)
                    max = up[color];
            }
        }
        if(max==-1) out.println(-1);
        else if(max >= n/2.0) out.println(0);
        else out.println( (n+1)/2 - max );
    }
    public static void main(String[] args) throws NumberFormatException, IOException
    {
        new D();
    }
    String nextToken() throws IOException
    {
        if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());
        return tok.nextToken();
    }
    int nextInt() throws NumberFormatException, IOException
    {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws NumberFormatException, IOException
    {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws NumberFormatException, IOException
    {
        return Double.parseDouble(nextToken());
    }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class D
{
	BufferedReader in;
	PrintStream out;
	StringTokenizer tok;
	public D() throws NumberFormatException, IOException
	{
		in = new BufferedReader(new InputStreamReader(System.in));
		//in = new BufferedReader(new FileReader("in.txt"));
		out = System.out;
		run();
	}
	void run() throws NumberFormatException, IOException
	{
		HashSet<Integer> colors = new HashSet<Integer>();
		HashMap<Integer,Integer> up = new HashMap<Integer,Integer>();
		HashMap<Integer,Integer> total = new HashMap<Integer,Integer>();
		int n = nextInt();
		for(int i = 0; i < n; i++)
		{
			int a = nextInt();
			int b = nextInt();
			if(up.containsKey(a)) up.put(a, up.get(a)+1);
			else up.put(a, 1);
			if(total.containsKey(a)) total.put(a, total.get(a)+1);
			else total.put(a, 1);
			if(a!=b)
			{
				if(total.containsKey(b)) total.put(b, total.get(b)+1);
				else total.put(b, 1);
			}
			colors.add(a);
			colors.add(b);
		}
		int max = -1;
		for(Integer color : colors)
		{
			if(total.get(color) >= n/2.0)
			{
				int sup = 0;
				if(up.containsKey(color))
					sup = up.get(color);
				if(sup>max)
					max = sup;
			}
		}
		if(max==-1) out.println(-1);
		else if(max >= n/2.0) out.println(0);
		else out.println( (n+1)/2 - max );
	}
	public static void main(String[] args) throws NumberFormatException, IOException
	{
		new D();
	}
	String nextToken() throws IOException
	{
		if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());
		return tok.nextToken();
	}
	int nextInt() throws NumberFormatException, IOException
	{
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws NumberFormatException, IOException
	{
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws NumberFormatException, IOException
	{
		return Double.parseDouble(nextToken());
	}
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class D
{
    BufferedReader in;
    PrintStream out;
    StringTokenizer tok;
    public D() throws NumberFormatException, IOException
    {
        in = new BufferedReader(new InputStreamReader(System.in));
        //in = new BufferedReader(new FileReader("in.txt"));
        out = System.out;
        run();
    }
    void run() throws NumberFormatException, IOException
    {
        HashSet<Integer> colors = new HashSet<Integer>();
        HashMap<Integer,Integer> up = new HashMap<Integer,Integer>();
        HashMap<Integer,Integer> total = new HashMap<Integer,Integer>();
        int n = nextInt();
        for(int i = 0; i < n; i++)
        {
            int a = nextInt();
            int b = nextInt();
            if(up.containsKey(a)) up.put(a, up.get(a)+1);
            else up.put(a, 1);
            if(total.containsKey(a)) total.put(a, total.get(a)+1);
            else total.put(a, 1);
            if(a!=b)
            {
                if(total.containsKey(b)) total.put(b, total.get(b)+1);
                else total.put(b, 1);
            }
            colors.add(a);
            colors.add(b);
        }
        int max = -1;
        for(Integer color : colors)
        {
            if(total.get(color)>= n/2.0)
            {
                int sup = 0;
                if(up.containsKey(color))
                    sup = up.get(color);
                if(sup>max)
                    max = sup;
            }
        }
        if(max==-1) out.println(-1);
        if(max>=n/2.0)out.println(0);
        else out.println((n+1)/2-max);
    }
    public static void main(String[] args) throws NumberFormatException, IOException
    {
        new D();
    }
    String nextToken() throws IOException
    {
        if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());
        return tok.nextToken();
    }
    int nextInt() throws NumberFormatException, IOException
    {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws NumberFormatException, IOException
    {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws NumberFormatException, IOException
    {
        return Double.parseDouble(nextToken());
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.HashMap;
import java.util.Map;

public class D {

    static StreamTokenizer st;
    public static void main(String[] args) throws IOException{
        st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
        int[][]a = new int[2*n+1][2];
        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            int up = nextInt();
            int down = nextInt();
            int id1 = 0;
            if (map.get(up)==null) {
                map.put(up, ++cnt);
                id1 = cnt;
            }
            else
                id1 = map.get(up);
            int id2 = 0;
            if (map.get(down)==null) {
                map.put(down, ++cnt);
                id2 = cnt;
            }
            else
                id2 = map.get(down);
            a[id1][0]++;
            if (up != down)
                a[id2][1]++;
        }
        int min = (int) 1e9;
        int half = n/2 + n%2;
        for (int i = 1; i <= cnt; i++) {
            if (a[i][0] >= half) {
                System.out.println(0);
                return;
            }
            else {
                if (a[i][0]+a[i][1] >= half) {
                    min = Math.min(min, half-a[i][0]);
                }
            }
        }
        if (min==1e9)
            System.out.println(-1);
        else
            System.out.println(min);
        pw.close();
    }

    private static int nextInt() throws IOException{
        st.nextToken();
        return (int) st.nval;
    }

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

public class D {

    static StreamTokenizer st;
    public static void main(String[] args) throws IOException{
        st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        Map<Integer, Integer> map = new TreeMap<Integer, Integer>();
        int[][]a = new int[2*n+1][2];
        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            int up = nextInt();
            int down = nextInt();
            int id1 = 0;
            if (map.get(up)==null) {
                map.put(up, ++cnt);
                id1 = cnt;
            }
            else
                id1 = map.get(up);
            int id2 = 0;
            if (map.get(down)==null) {
                map.put(down, ++cnt);
                id2 = cnt;
            }
            else
                id2 = map.get(down);
            a[id1][0]++;
            if (up != down)
                a[id2][1]++;
        }
        int min = (int) 1e9;
        int half = n/2 + n%2;
        for (int i = 1; i <= cnt; i++) {
            if (a[i][0] >= half) {
                System.out.println(0);
                return;
            }
            else {
                if (a[i][0]+a[i][1] >= half) {
                    min = Math.min(min, half-a[i][0]);
                }
            }
        }
        if (min==1e9)
            System.out.println(-1);
        else
            System.out.println(min);
        pw.close();
    }

    private static int nextInt() throws IOException{
        st.nextToken();
        return (int) st.nval;
    }

}


import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.*;

public class D205 implements Runnable{

    public static void main(String args[]){
       new D205().run();
    }

     public static final String INPUT_FILE = "input.in";
     public static final String OUTPUT_FILE = "output.out";

    @Override
    public void run(){
        try{
//        in = new BufferedReader(new FileReader(INPUT_FILE));
//        out = new PrintWriter(new BufferedWriter(new FileWriter(OUTPUT_FILE)));
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            tok = null;
            solve();
            in.close();
            out.close();

        }
        catch(IOException e){
            e.printStackTrace();
            System.exit(0);
        }
    }

    int nextInt()throws IOException{
        return Integer.parseInt(nextToken());
    }

    double nextDouble()throws IOException{
        return Double.parseDouble(nextToken());
    }

    long nextLong() throws IOException{
        return Long.parseLong(nextToken());
    }

    String nextToken()throws IOException{
        while(tok == null || !tok.hasMoreTokens()){
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;
    //////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////
    int N;
    int[] front;
    int[] back;
    int needed;
    private void solve()throws IOException{
        Map<Integer, Integer> mp = new HashMap<Integer, Integer>();
        N = nextInt();
        front = new int[N];
        back = new int[N];

        for(int i = 0; i < N; i++){
            front[i] = nextInt();
            back[i] = nextInt();
            if(mp.containsKey(front[i])) mp.put(front[i], mp.get(front[i]) + 1);
            else mp.put(front[i], 1);
            if(mp.containsKey(back[i])) mp.put(back[i], mp.get(back[i]) + 1);
            else mp.put(back[i], 1);
        }

        int ans = Integer.MAX_VALUE;
        needed = (N + 1) / 2;
        for(int k : mp.keySet()){
            if(mp.get(k) >= needed){
                int now = doit(k);
                ans = Math.min(ans , now);
            }
        }

        if(ans != Integer.MAX_VALUE) out.println(ans);
        else out.println(-1);

    }//solve

    private int doit(int x){
        int f = 0, b = 0;
        for(int i = 0; i < N; i++){
            if(front[i] == x) f++; else if(back[i] == x) b++;
        }

        if(f >= needed) return 0;
        else return needed - f;
    }

}