import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
    int n = scan!int;
    S[] xs;
    int zerocount = 0;
    foreach(i; 0 .. n){
        long a = scan!long, b = scan!long;
        if(a == 0 && b == 0) zerocount += 1;
        else if(a > 0 && b >= 0) xs ~= S(a, b, 0);
        else if(a <= 0 && b > 0) xs ~= S(b, -a, 1);
        else if(a < 0 && b <= 0) xs ~= S(-a, -b, 0);
        else if(a >= 0 && b < 0) xs ~= S(-b, a, 1);
    }
    log("xs:", xs);

    long[2][long[2]] cnt;
    foreach(x; xs){
        if(x.u !in cnt) cnt[x.u] = [0, 0];
        cnt[x.u][x.f] += 1;
    }
    log("cnt:", cnt);

    Finite ans = Finite(1);
    foreach(c; cnt){
        ans *= pow(2, c[0]) + pow(2, c[1]) - 1;
    }
    ans -= 1;
    ans += zerocount;
    ans.writeln;
}

struct S{
    long[2] u;
    int f; // 90度回転のとき1
    this(long a, long b, int f){
        long g = gcd(a, b);
        this.u = [a / g, b / g];
        this.f = f;
    }
}

struct Vector{
    long x, y;
    Argument arg;
    long square;
    real length;
    this(long x, long y){
        this.x = x, this.y = y;
        if(x != 0 || y != 0) arg = Argument(x, y);
        square = x * x + y * y;
        length = square.to!real.sqrt;
    }
    bool opEquals(Vector v){
        return x == v.x && y == v.y;
    }
	Vector opUnary(string s)(){
		if(s == "+") return Vector(x, y);
		if(s == "-") return Vector(-x, -y);
		assert(0, "Operator unary " ~ s ~ " not implemented");
	}
	Vector opBinary(string s)(Vector v){
		if(s == "+") return Vector(x + v.x, y + v.y);
		if(s == "-") return Vector(x - v.x, y - v.y);
		assert(0, "Operator " ~ s ~ " not implemented");
	}
    Vector opBinary(string s)(long k){
        if(s == "*") return Vector(x * k, y * k);
		assert(0, "Operator " ~ s ~ " not implemented");
    }
    Vector opBinaryRight(string s)(long k){
        if(s == "*") return Vector(k * x, k * y);
		assert(0, "Operator " ~ s ~ " not implemented");
    }

    int quadrant(){ return arg.quadrant; }
    bool isLeftTo(Vector v){ return arg.isLeftTo(v.arg); }
    bool follows(Vector v){ return arg.follows(v.arg); }
    real angle(){ return arg.angle; }
    string toString(){ return "(" ~ x.to!string ~ ", " ~ y.to!string ~ ")"; }
}
struct Argument{
    long x, y;
    this(long x, long y){
        assert(x != 0 || y != 0);
        this.x = x, this.y = y;
    }
    
    bool opEquals(Argument a){
        return quadrant == a.quadrant && y * a.x == x * a.y;
    }
	Argument opUnary(string s)(){
		if(s == "+") return Argument(x, y);
		if(s == "-") return Argument(-x, -y);
		assert(0, "Operator unary " ~ s ~ " not implemented");
	}
	Argument opBinary(string s)(Argument a){
		if(s == "+") return Argument(x * a.x - y * a.y, y * a.x + x * a.y);
		if(s == "-") return Argument(x * a.x + y * a.y, y * a.x - x * a.y);
		assert(0, "Operator " ~ s ~ " not implemented");
	}

    // 象限
    // (1, 0) ≦ this ＜ (0, 1) のとき 1　など
    int quadrant(){
        if(x > 0 && y >= 0) return 1;
        if(x <= 0 && y > 0) return 2;
        if(x < 0 && y <= 0) return 3;
        if(x >= 0 && y < 0) return 4;
        assert(0);
    }

    // a から見て this は左側である（aと平行は含まない）
    bool isLeftTo(Argument a){
        return y * a.x - x * a.y > 0;
    }

    // (1, 0) から反時計回りに見て this < a である
    bool follows(Argument a){
        int q = this.quadrant, aq = a.quadrant;
        if(q != aq) return q < aq;
        else return a.isLeftTo(this);
    }

    // 角度 (0 ≦ θ ＜ 2π)
    real angle(){
        real ans = atan2(y.to!real, x.to!real);
        if(ans < 0) return ans + PI + PI;
        else return ans;
    }

    string toString(){ return "(" ~ x.to!string ~ ", " ~ y.to!string ~ ")"; }
}


// 素数位数有限体
// 負の数を与えても大丈夫（Finite(-1) などは Finite(mod - 1) の意味になる）
import std.conv;
struct Finite{
	long value; static long mod = 1_000_000_007;
	this(long v){ value = val(v); }
	static long val(long v){ return (v + mod  - (v / mod) * mod) % mod; }
	bool opCast(T: bool)(){ return value != 0; }
	bool opEquals(Finite b){ return(value == b.value); }
	string toString(){ return value.to!string; }

	Finite opUnary(string s){ long v;
		if(s == "+") v = value;
		else if(s == "-") v = mod - value;
		else if(s == "++") v = value + 1;
		else if(s == "--") v = value + mod - 1;
		else assert(0, "Operator unary " ~ s ~ " not implemented");
		return Finite(v);
	}

	Finite opBinary(string s)(Finite b){ return opBinary!s(b.value); }
	Finite opBinary(string s)(long u){ long v;
		if(s == "+") v = value + u;
		else if(s == "-") v = value + mod - u;
		else if(s == "*") v = value * u;
		else if(s == "/") v = value * inv(u);
		else assert(0, "Operator " ~ s ~ " not implemented");
		return Finite(v);
	}
	Finite opBinaryRight(string s)(long u){ long v;
		if(s == "+") v = u + value;
		else if(s == "-") v = u + mod - value;
		else if(s == "*") v = u * value;
		else if(s == "/") v = u * invvalue;
		else assert(0, "Operator " ~ s ~ " not implemented");
		return Finite(v);
	}
	Finite opAssign(long v){ value = v; return this; }

	Finite opOpAssign(string s)(Finite b){ return opOpAssign!s(b.value); }
	Finite opOpAssign(string s)(long v){
		if(s == "+") value = (value + v) % mod;
		else if(s == "-") value = (value + mod - v) % mod;
		else if(s == "*") value = (value * v) % mod;
		else if(s == "/") value = (value * inv(v)) % mod;
		else assert(0, "Operator " ~ s ~ "= not implemented");
		return this;
	}
	
	private static long[] _inv = [0, 1];
	long invvalue(){ return inv(value); }
	long inv(long v){ int i = val(v).to!int;
		while(i >= _inv.length){
			_inv ~= _inv[(mod % $).to!int] * (mod - mod / _inv.length) % mod;
		}
		return _inv[i];
	}
	
}

// ---以下はユーティリティ--- //

/// mod p における累乗
/// 例 power(5, 3) = Finite(125)
/// オーダーは a ** b を計算する場合 O(log b)
Finite power(long a, long b){
	Finite m = Finite(a);
	Finite ans = Finite(1);
	while(b > 0){
		if(b % 2) ans = m;
		m *= m;
		b /= 2;
	}
	return ans;
}
Finite power(Finite a, long b){ return power(a.value, b); }

/// mod p における階乗
/// 例 perm(6) = Finite(120)
/// オーダーはプログラム全体で出てくる最大の引数Nに対してO(N)
Finite perm(long x){ int i = Finite.val(x).to!int;
	static Finite[] _perm = [];
	if(_perm.length == 0) _perm ~= Finite(1);
	while(i >= _perm.length) _perm ~= _perm[$ - 1] * _perm.length;
	return _perm[i];
}

/// mod p における階乗の逆元
/// 例 invperm(6) = Finite(1) / Finite(120)
/// オーダーはプログラム全体で出てくる最大の引数Nに対してO(N)
/// ※ invperm(x) と inv(perm(x)) は同じ値だが、後者は計算量が O(mod) になる
Finite invperm(long x){ int i = Finite.val(x).to!int;
	static Finite[] _iperm = [];
	if(_iperm.length == 0) _iperm ~= Finite(1);
	while(i >= _iperm.length) _iperm ~= _iperm[$ - 1] / _iperm.length;
	return _iperm[i];
}

/// mod p における二項係数（定義に注意：(a + b)! / a! / b! ）
/// 例 pascal(3, 2) = Finite(10)
/// ただし、「a < 0 または b < 0」のとき答えは 0 を返します。
Finite pascal(long a, long b){
	if(a < 0 || b < 0) return Finite(0);
	return perm(a + b) * invperm(a) * invperm(b);
}


/// 最大公約数。最大の公約数。
/// 例 gcd(12, -18) = 6, gcd(-12, -18) = 6, gcd(12, 0) = 12, gcd(0, 0) = 0
/// ※本当は gcd(0, 0) は存在しないが便宜上 0 を返している
long gcd(long a, long b){
	if(a < 0) a = -a;
	if(b == 0) return a;
	if(b < 0) return gcd(a, -b);
	if(a % b == 0) return b;
	if(a < b) return gcd(b, a);
	else return gcd(b, a % b);
}
