You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines.

Multiset is a set where equal elements are allowed.

Multiset is called symmetric, if there is a point P on the plane such that the multiset is [centrally symmetric](https://en.wikipedia.org/wiki/Point_reflection) in respect of point P.

Input

The first line contains a single integer n (1 ≤ n ≤ 2000) — the number of points in the set.

Each of the next n lines contains two integers xi and yi ( - 106 ≤ xi, yi ≤ 106) — the coordinates of the points. It is guaranteed that no two points coincide.

Output

If there are infinitely many good lines, print -1.

Otherwise, print single integer — the number of good lines.

Examples

Input

3
1 2
2 1
3 3


Output

3


Input

2
4 3
1 2


Output

-1

Note

Picture to the first sample test:

<image>

In the second sample, any line containing the origin is good.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.StringTokenizer;

public class d {
    static double EPS = 1e-6    ;
    public static void main(String[] args) {
        FS in = new FS(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        int n = in.nextInt();
        
        Vec com = new Vec(0, 0);
        Vec[] vecs = new Vec[n];
        for(int i = 0; i < n; i++) {
            com = com.add(vecs[i] = new Vec(in.nextInt(), in.nextInt()));
        }
        com = com.scaleR(n);
        
        boolean[] works = new boolean[n];
        Arrays.fill(works, true);
        int num = n;
        for(int i = 0; i < n; i++) {
            if(vecs[i].equals(com)) {
                works[i] = false;
                num--;
                continue;
            }
            for(int j = 0; j < i; j++) {
                if(works[j] && vecs[i].sub(com).equals(com.sub(vecs[j]))) {
                    works[i] = works[j] = false;
                    num -= 2;
                    break;
                }
            }
        }
        Vec[] act = new Vec[num];
        int curr = 0;
        for(int i = 0; i < n; i++) if(works[i]) act[curr++] = vecs[i];
        n = num;
        if(n == 0) {
            System.out.println(-1);
            return;
        }
        int res = 0;
        
        Vec[] norms = new Vec[n];
        
        outer: for(int i = 0; i < n; i++) {
            Vec diff = act[i].sub(act[0]);
            Vec mid = act[0].add(diff.scaleR(2));
            Vec perp = com.sub(mid).rot90();
            if(perp.equals(new Vec(0, 0))) continue;
            Vec norm = perp;
            norm = norm.scaleR(Math.sqrt(norm.dot(norm)));
            if(norm.x < 0 || (eq(norm.x, 0) && norm.y < 0)) {
                norm.x *= -1;
                norm.y *= -1;
            }
            norms[i] = norm;
            for(int j = 0; j < i; j++) {
                if(norms[j].equals(norm)) continue outer;
            }
            double[] arr = new double[n];
            for(int j = 0; j < n; j++) arr[j] = perp.dot(act[j]);
            Arrays.sort(arr);
            double cent = (arr[0]+arr[n-1])/2;
            for(int j = 0; j < n; j++) {
                if(!eq(cent-arr[j], arr[n-1-j]-cent)) continue outer;
            }
            res++;
        }
        System.out.println(res);
        out.close();
    }
    
    static class Vec {
        double x, y;
        
        public Vec(double A, double B) {
            x = A;
            y = B;
        }
        
        public Vec add(Vec o) {
            return new Vec(x+o.x, y+o.y);
        }
        
        public Vec sub(Vec o) {
            return new Vec(x-o.x, y-o.y);
        }
        
        public Vec scale(double s) {
            return new Vec(x*s, y*s);
        }
        
        public Vec scaleR(double s) {
            return new Vec(x/s, y/s);
        }
        
        public Vec rot90() {
            return new Vec(-y, x);
        }
        
        public double dot(Vec o) {
            return x*o.x + y*o.y;
        }
        
        @Override
        public boolean equals(Object o) {
            return eq(x, ((Vec)o).x) && eq(y, ((Vec)o).y);
        }
    }
    
    static boolean eq(double a, double b) {
        return Math.abs(a-b) <= EPS;
    }
    
    static class FS {
        BufferedReader in;
        StringTokenizer token;
        
        public FS(InputStream str) {
            in = new BufferedReader(new InputStreamReader(str));
        }
        
        public String next() {
            if(token == null || !token.hasMoreElements()) {
                try {
                    token = new StringTokenizer(in.readLine());
                } catch (IOException ex) {
                }
                return next();
            }
            return token.nextToken();
        }
        
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}