jiahuimbzuai/CoQuIR huggingface dataset:
//  [c]
#include<stdio.h>

void QSort(long x[ ], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */

    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

    while (1) {                    /* 無限ループ */

        while (x[i] < pivot)       /* pivot より大きい値が */
            i++;                   /* 出るまで i を増加させる */

        while (pivot < x[j])       /* pivot より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */

        Swap(x, i, j);             /* x[i] と x[j]を交換 */
        i++;                       /* 次のデータ */
        j--;
    }

    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

  /* 配列の要素を交換する */
void Swap(long x[ ], int i, int j)
{
    int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

int main(){
  int n,i,cnt=0,flag=0,j;
  long a[100000];
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%ld",&a[i]);
  QSort(a, 0, n - 1);
  for(i=0;i<n;i++){
    flag=1;
    for(j=1+i;j<n;j++){
      if(a[i]==a[j])
        flag=(1+flag)%2;
      else break;
    }
    cnt+=flag;
    i=j-1;
  }
  printf("%d\n",cnt);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

typedef struct List {
	struct List *prev, *next;
	int id;
} list;

int main()
{
	int i, N, A[100001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	
	list *p, *hash[10007] = {}, data[100001];
	long long count = 0;
	for (i = 1; i <= N; i++) {
		for (p = hash[A[i] % 10007]; p != NULL; p = p->next) {
			if (p->id == A[i]) break;
		}
		if (p == NULL) {
			data[i].prev = NULL;
			data[i].next = hash[A[i] % 10007];
			if (data[i].next != NULL) (data[i].next)->prev = &(data[i]);
			data[i].id = A[i];
			hash[A[i] % 10007] = &(data[i]);
			count++;
		} else {
			if (p->prev != NULL) p->prev->next = p->next;
			else hash[A[i] % 10007] = p->next;
			if (p->next != NULL) p->next->prev = p->prev;
			count--;
		}
	}
	
	printf("%lld\n", count);
	fflush(stdout);
	return 0;
}
//  [c]
#include<stdio.h>

void QSort(long x[ ], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */

    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

    while (1) {                    /* 無限ループ */

        while (x[i] < pivot)       /* pivot より大きい値が */
            i++;                   /* 出るまで i を増加させる */

        while (pivot < x[j])       /* pivot より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */

        Swap(x, i, j);             /* x[i] と x[j]を交換 */
        i++;                       /* 次のデータ */
        j--;
    }

    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

  /* 配列の要素を交換する */
void Swap(long x[ ], int i, int j)
{
    long temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

int main(){
  long a[100000],n,i,cnt=0,cnt2=0,j,b,c=1;
  scanf("%ld",&n);
  for(i=0;i<n;i++)
    scanf("%ld",&a[i]);
  QSort(a, 0, n - 1);
  /*for(i=0;i<n;i++)
    printf("%d\n",a[i]);*/
  b=a[0];
  for(i=1;i<n;i++){
    if(a[i]==b){
      c=(c+1)%2;
      if(i==n-1)
        cnt+=c;
    }
    else{
      cnt+=c;
      c=1;
      b=a[i];
      if(i==n-1)
        cnt++;
    }
  }
  printf("%ld\n",cnt);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;

int compare_ll(const void *a, const void *b){
    return *(ll*)a - *(ll*)b;
}

int main(){
    int n, ans=0;
    ll a[100001]={0};
    scanf("%d",&n);
    for(int i=0; i<n; i++){ scanf("%lld",&a[i]); }
    qsort( a, n, sizeof(ll), compare_ll );

    int cnt=1, tmp=a[0];
    for(int i=1; i<n; i++){
        if( tmp==a[i] ){ cnt++; }
        else{
            if( cnt&1 ){ ans++; }
            tmp=a[i];
            cnt=1;
        }
    }
    printf("%d\n",ans);
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;

int compare_ll(const void *a, const void *b){
    return *(ll*)a - *(ll*)b;
}

int main(){
    int n, ans=0;
    ll a[101]={0};
    scanf("%d",&n);
    for(int i=0; i<n; i++){ scanf("%lld",&a[i]); }
    qsort( a, n, sizeof(ll), compare_ll );

    int cnt=1, tmp=a[0];
    for(int i=1; i<n; i++){
        if( tmp==a[i] ){ cnt++; }
        else{
            if( cnt&1 ){ ans++; }
            tmp=a[i];
            cnt=1;
        }
    }
    printf("%d\n",ans);
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}

int main(void){
    int n;
    int a[100000+5];
    scanf("%d", &n);
    for(int i=0; i<n; i++)scanf("%d", &a[i]);
    qsort(a, n, sizeof(int), compare_int);
    
    int ans=0;
    for(int i=0; i<n-1; i++){
        int cnt=1;
        while(a[i]==a[i+1]){
            cnt++;
            i++;
        }
        ans+=cnt%2;
    }
    printf("%d\n", ans);
    return 0;
}
//  [javascript]
'use strict';

const main = arg => {

    const input = arg.split("\n");
    const n = parseInt(input[0]);

    let freq = new Map();
    for (let i = 0; i < n; i++) {
        const a = parseInt(input[i + 1].trim());
        if (freq.has(a)) {
            freq.set(a, freq.get(a) + 1);
        } else {
            freq.set(a, 1);
        }
    }

    let count = 0;
    for (const [key, value] of freq.entries()) {
        if (value % 2 == 1) {
            count++;
        }
    }
    console.log(count);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
console.log((args=>{
  const [N,...A] = args.trim().split`\n`.map(v=>v|0);
  const ex = new Map();
  for ( let i = 0; i < N; i++ ) ex.set( A[i], ex.get(A[i])^1 );
  let s = 0;
  for ( const [,v] of ex ) s += v;
  return `${s}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
//  [javascript]
"use strict"

function main(input) {
  input = input.split(/\n/).map(v => ~~v)
  let set = new Set()
  for (let i = 1; i < input.length-1; i++) {
    //
    if (set.has(input[i])) {
      set.delete(input[i])
    } else {
      set.add(input[i])
    }
  }
  console.log(set.size)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [javascript]
'use strict';

const main = arg => {

    const input = arg.split("\n");
    n = parseInt(input[0]);

    let freq = Map();
    for (let i = 0; i < n; i++) {
        const a = parseInt(input[i + 1]);
        if (freq.has(a)) {
            freq.set(freq.get(a) + 1);
        } else {
            freq.set(a, 1);
        }
    }

    let count = 0;
    for (let [key, value] of freq.entries()) {
        if (value % 2 == 1) {
            count++;
        }
    }
    console.log(count);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main (input) {
  input = input.split("\n").map(Number);
  var N = input[0];
  input.pop();
  input.shift();
  var now_j = [input[0]];
  input.shift();
  input.forEach (i => {
    if (now_j.some(inp => inp == i)) {
      now_j.splice(now_j.indexOf(i), 1);
    }
    else {
      now_j.push(i);
    }
  });
  console.log(now_j.length);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main (input) {
  input = input.split("\n").map(Number);
  var N = input[0];
  input.pop();
  input.shift();
  var now_j = [input[0]];
  input.shift();
  for (var i of input) {
    if (now_j.some(inp => inp == i)) {
      now_j.splice(now_j.indexOf(i), 1);
    }
    else {
      now_j.push(i);
    }
  }
  console.log(now_j.length);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func r() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n := r()

	a := make(map[int]int, n)
	var ans int
	for i := 0; i < n; i++ {
		t := r()
		if a[t] == 1 {
			a[t] = 0
			ans--
		} else {
			a[t] = 1
			ans++
		}
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func r() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n := r()

	a := make(map[int]int, n)
	for i := 0; i < n; i++ {
		x := r()
		if _, ok := a[x]; !ok {
			a[x] = 1
		} else {
			a[x]++
		}
	}
	var ans int
	for _, v := range a {
		if v%2 != 0 {
			ans++
		}
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	as := map[int]bool
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		as[a] = !as[a]
	}

	ans := 0
	for _, b := range as {
		if b {
			ans++
		}
	}

	fmt.Print(ans)
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}
	sort.Sort(sort.IntSlice(as))

	ans := 0
	tmp := 0
	tmpnum := 0
	for _, a := range as {
		if tmp == a {
			tmpnum++
			continue
		}

		tmp = a
		if tmpnum%2 != 0 {
			ans++
		}
	}
	fmt.Print(ans)
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}
	sort.Sort(sort.IntSlice(as))

	ans := 0
	tmp := ""
	tmpnum := 0
	for _, a := range as {
		if tmp == a {
			tmpnum++
			continue
		}

		tmp = a
		if tmpnum%2 != 0 {
			ans++
		}
	}
	fmt.Print(ans)
}
//  [ruby]
n=gets.to_i
a=$<.map{|e|e.to_i}.sort
c=0
cc=false
t=a[0]
a.each do |e|
  if t != e
    c+=1 if cc
    t=e
    cc=true
  else
    cc = !cc
  end
end
c+=1 if cc
p c
//  [ruby]
N,*as=$<.read.split.map(&:to_i)

h = {}

as.each do |a|
    if h[a]
        h.delete(a)
    else
        h[a] = 1
    end
end

puts h.keys.count
//  [ruby]
a = []

gets.to_i.times do
  a << gets.to_i
end

prev_n = 0
os = false
res = 0

a.sort.each do |n|
  if n != prev_n
    if os
      res += 1
    end

    os = true
  else
    os = !os
  end

  prev_n = n
end

if os
  res += 1
end

puts res
//  [ruby]
n = gets.to_i
rec = []
n.times do
  a = gets.to_i
  if rec[a-1] = 1
    rec[a-1] = 0
  else
    rec[a-1] = 1
  end
end
rec.compact!
puts rec.sum
//  [ruby]
n = gets.to_i
arr = []
n.times do
  arr << gets.to_i
end
arr.sort!
ans = 1
count = 0
flag = 0
for i in 1..(n-1)
  if arr[i-1] != arr[i]
    ans += 1
  elsif arr[i-1] == arr[i] && flag == 0
    ans -= 1
    flag = 0
  else
    ans += 1
    flag = 1
  end
end
puts ans
//  [ruby]
n = gets.to_i
arr = []
n.times do
  arr << gets.to_i
end
arr.sort!
ans = 0
count = 0
flag = 0
for i in 1..(n-1)
  if arr[i-1] != arr[i]
    ans += 1
  elsif arr[i-1] == arr[i] && flag == 1
    ans -= 1
    flag = 0
  else
    ans += 1
    flag = 1
  end
end
puts ans - 1
//  [rust]
use std::io::Read;
use std::collections::HashSet;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();

    let mut set: HashSet<usize> = HashSet::with_capacity(n);

    for _ in 0..n {
        let a: usize = iterator.next().unwrap().parse().unwrap();
        if set.contains(&a) {
            set.remove(&a);
        } else {
            set.insert(a);
        }
    }

    return set.len().to_string();
}
//  [rust]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { let mut $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { let $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
use std::collections::HashSet;
fn main() {
    input! {
        n: u64,
        mut a: [u64; n]
    }
    let mut set = HashSet::with_capacity(100_000);

    for &x in &a {
        if !set.remove(&x) {
            set.insert(x);
        }
    }
    println!("{}", set.len());
}
//  [rust]
use std::collections::HashSet;
use std::io::{self, BufRead, Read};

fn main() {
    let stdin = io::stdin();
    let mut stdin = stdin.lock();
    for _ in stdin.by_ref().bytes().take_while(|r| r.as_ref().unwrap() != &b'\n') {}

    let mut set = HashSet::with_capacity(100_000);
    for a in stdin.lines() {
    	let a: u32 = a.unwrap().parse().unwrap();
        if ! set.remove(&a) { set.insert(a); }
    }

    println!("{}", set.len());
}
//  [rust]
use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let mut i: usize = 0;
    let mut v: Vec<usize> = Vec::new();

    while i < n {
        let a: usize = parse_line().unwrap();
        if !v.contains(&a) {
            v.push(a);
        } else {
            v.retain(|&x| x != a);
        }
        i = i + 1;
    }

    println!("{}", v.len());
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let mut v = Vec::new();
    for _ in 0..n {
        let a:usize = read();
        if v.contains(&a) {
            v.retain(|&x| x != a);
        } else {
            v.push(a);
        }
    }
    println!("{}", v.len());
}
//  [rust]
use std::io::{stdin, BufRead};
fn main() {
    let stdin = stdin();
    let mut stdinlock = stdin.lock();
    let mut n = String::new();
    let _ = stdinlock.read_line(&mut n);
    let n: usize = n.trim().parse().expect("N");
    let mut v: Vec<u32> = Vec::with_capacity(n);
    for line in stdinlock.lines() {
        v.push(line.expect("line").trim().parse().expect("parse"));
    }
    v.sort();
    let mut n: u32 = 0;
    let mut current = v[0];
    let mut oddness = true;
    for &ai in &v[1..] {
        if ai == current {
            oddness = !oddness;
        } else {
            if oddness {
                n += 1;
            }
            current = ai;
            oddness = true;
        }
    }
    println!("{}", n);
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}

func readLines() -> [String] {
    return readLine()!.map { String($0) }
}

///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}
// https://algo-logic.info/divisor/
/// 約数の配列を返す
func divisor(_ n:Int) -> [Int] {
    var ret = [Int]()
    var i = 1
    while i * i <= n {
        if n % i == 0 {
            ret.append(i)
            if i * i != n {
                ret.append(n / i)
            }
        }
        i += 1
    }
    return ret.sorted()
}

func main() {
    let n = readInt()
    var aryA = [Int]()
    for _ in 0..<n {
        aryA.append(readInt())
    }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    aryA.sort()
    var left = 0
    var right = 1
    var ans = 0
    while right < n {
        while right < n && aryA[left] == aryA[right] {
            right += 1
        }
        if (right - left) % 2 == 1 {
            ans += 1
        }
        left = right
    }
    print(ans)
}
main()
//  [swift]
var paper = [Int : Int]()
for _ in 0..<Int(readLine()!)! {
    let A = Int(readLine()!)!
    if paper[A] == nil {
        paper[A] = 1
    } else {
        paper[A] = nil
    }
}
print(paper.values.reduce(0){$0+$1})
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}

func readLines() -> [String] {
    return readLine()!.map { String($0) }
}

///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}
// https://algo-logic.info/divisor/
/// 約数の配列を返す
func divisor(_ n:Int) -> [Int] {
    var ret = [Int]()
    var i = 1
    while i * i <= n {
        if n % i == 0 {
            ret.append(i)
            if i * i != n {
                ret.append(n / i)
            }
        }
        i += 1
    }
    return ret.sorted()
}

func main() {
    let n = readInt()
    var aryA = [Int]()
    for _ in 0..<n {
        aryA.append(readInt())
    }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    aryA.sort()
    var left = 0
    var right = 1
    var ans = 0
    while right < n {
        while right < n && aryA[left] == aryA[right] {
            right += 1
        }
        if (right - left) % 2 == 1 {
            ans += 1
        }
        left = right
        right += 1
    }
    print(ans)
}
main()
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}

func readLines() -> [String] {
    return readLine()!.map { String($0) }
}

///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}
// https://algo-logic.info/divisor/
/// 約数の配列を返す
func divisor(_ n:Int) -> [Int] {
    var ret = [Int]()
    var i = 1
    while i * i <= n {
        if n % i == 0 {
            ret.append(i)
            if i * i != n {
                ret.append(n / i)
            }
        }
        i += 1
    }
    return ret.sorted()
}

func main() {
    let n = readInt()
    var aryA = [Int]()
    for _ in 0..<n {
        aryA.append(readInt())
    }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    aryA.sort()
    var left = 0
    var right = 1
    var ans = 0
    print(aryA)
    while right < n {
        while right < n && aryA[left] == aryA[right] {
            right += 1
        }
        if (right - left) % 2 == 1 {
            ans += 1
        }
        print(left, right)
        left = right
        right += 1
    }
    print(ans)
}
main()
//  [typescript]
"use strict";

main(require("fs").readFileSync("/dev/stdin", "utf8"));

function main(input) {
  const [n, ...a] = input.trim().split("\n").map(Number);

  const map = new Map();

  a.forEach(e => {
    if(map.has(e)) {
      map.delete(e);
    } else {
      map.set(e, true);
    }
  });
  const ans = map.size;
  console.log(ans);
}
//  [typescript]
"use strict";

main(require("fs").readFileSync("/dev/stdin", "utf8"));

function main(input) {
  const a = input.split("\n").map(Number).slice(1);

  const map = new Map();

  a.forEach(e => {
    if(map.has(e)) {
      map.delete(e);
    } else {
      map.set(e, true);
    }
  });
  
  const ans = map.size;
  console.log(ans);
}
//  [typescript]
"use strict";

main(require("fs").readFileSync("/dev/stdin", "utf8"));

function main(input) {
  const [n, ...a] = input.split("\n").map(Number);

  const map = new Map();

  a.forEach(e => {
    if(map.has(e)) {
      map.delete(e);
    } else {
      map.set(e, true);
    }
  });
  const ans = map.size;
  console.log(ans);
}
//  [python]
import sys, math

max_int = 1000000001  # 10^9+1
min_int = -max_int

n = int(sys.stdin.readline())
positive_counter = {}
negative_counter = {}
to_add = 0
a_zero_counter = b_zero_counter = 0
for _n in range(n):
    s = sys.stdin.readline()
    a, b = map(int, s.split())

    if a == 0 and b == 0:
        to_add += 1
        continue
    elif a == 0:
        a_zero_counter += 1
        continue
    elif b == 0:
        b_zero_counter += 1
        continue
    elif (a > 0) == (b > 0):
        a = abs(a)
        b = abs(b)
        gcd = math.gcd(a, b)
        definer = (a // gcd, b // gcd)

        if definer not in positive_counter:
            positive_counter[definer] = 1
        else:
            positive_counter[definer] += 1
    else:
        a = abs(a)
        b = abs(b)
        gcd = math.gcd(a, b)
        definer = (b // gcd, a // gcd)

        if definer not in negative_counter:
            negative_counter[definer] = 1
        else:
            negative_counter[definer] += 1

prod = 2 ** a_zero_counter + 2 ** b_zero_counter - 1
#print(positive_counter, negative_counter)
for k in positive_counter:
    if k in negative_counter:
        prod *= 2 ** positive_counter[k] + 2 ** negative_counter[k] - 1
        negative_counter.pop(k)
    else:
        prod *= 2 ** positive_counter[k]
    prod %= 1000000007

for k in negative_counter:
    prod *= 2 ** negative_counter[k]
    prod %= 1000000007

prod += to_add - 1

print(prod % 1000000007)
//  [python]
from collections import Counter
from math import gcd
import sys
input = sys.stdin.readline
n = int(input())
same, diff, zero_a, zero_b, zero_zero = 0, 0, 0, 0, 0
same_cnt = Counter()
diff_cnt = Counter()

for i in range(n):
    a, b = map(int, input().split())
    if a == b == 0:
        zero_zero += 1
    elif a == 0:
        zero_a += 1
    elif b == 0:
        zero_b += 1
    elif a * b > 0:
        x = gcd(a, b)
        a, b = a // x, b // x
        same += 1
        same_cnt[(abs(a), abs(b))] += 1
    else:
        x = gcd(a, b)
        a, b = a // x, b // x
        diff += 1
        diff_cnt[(abs(a), -abs(b))] += 1


ans = 1
mod = 10 ** 9 + 7

for (a, b) in diff_cnt.keys():
    s = same_cnt[(-b, a)]
    d = diff_cnt[(a, b)]
    if s > 0:
        same -= s
        diff -= d
        ans = ans * (pow(2, s, mod) + pow(2, d, mod) - 1) % mod

ans = ans * pow(2, same + diff, mod) % mod

ans = ans * (pow(2, zero_a, mod) + pow(2, zero_b, mod) - 1) - 1
print((ans + zero_zero) % mod)
//  [python]
mod = 1000000007
eps = 10**-9


def main():
    import sys
    from math import gcd
    input = sys.stdin.buffer.readline

    N = int(input())
    cnt = {}
    zz = 0
    for _ in range(N):
        a, b = map(int, input().split())
        if a == b == 0:
            zz += 1
            continue
        if a < 0:
            a = -a
            b = -b
        elif a == 0:
            if b < 0:
                b = -b
        g = gcd(abs(a), abs(b))
        x = (a // g, b // g)
        if x in cnt:
            cnt[x] += 1
        else:
            cnt[x] = 1

    ans = 1
    num = 0
    for x in cnt:
        if cnt[x] == 0:
            continue
        a, b = x
        if b > 0:
            y = (b, -a)
        else:
            y = (-b, a)
        if y in cnt:
            nx = cnt[x]
            ny = cnt[y]
            cnt[y] = 0
            ans = (ans * ((pow(2, nx, mod) - 1) + (pow(2, ny, mod) - 1) + 1)%mod)%mod
        else:
            num += cnt[x]
    ans = (ans * pow(2, num, mod))%mod
    ans = (ans - 1)%mod
    print((ans + zz)%mod)


if __name__ == '__main__':
    main()
//  [python]
#include<bits/stdc++.h>
using namespace std;
using ll=long long int;
ll mod=1e9+7;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int main()
{
    
    vector<ll> powe(1e6,0);
    powe[0]=1;
    for(int i=1;i<1e6;i++)
    {
        powe[i]=(powe[i-1]*2)%mod;
    }
    int n;
    cin>>n;
    vector<pair<ll,ll> > a(n);
    map<pair<ll,ll>,int> m;
    cout<<gcd(0,0)<<endl;
    int ct1=0;
    int ct2=0;
    int ct3=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i].first>>a[i].second;
        if(a[i].first==0&&a[i].second==0)
        {
            ct1++;
            continue;
        }
        else if(a[i].first==0||a[i].second==0)
        {
            ct2++;
            continue;
        }
        ll p=gcd(a[i].first,a[i].second);
        a[i].first/=p;
        a[i].second/=p;
         if(a[i].first>0&&a[i].second<0)
        {
            a[i].first=-a[i].first;
            a[i].second=-a[i].second;
        }
        if(a[i].second<0&&a[i].first<0)
        {
            a[i].second=-a[i].second;
            a[i].first=-a[i].first;
        }
        m[a[i]]++;
    }
    ll ans=1;
    for(auto it:m)
    {
        if(it.first.first<0)
        {
            if(m.find({it.first.second,-it.first.first})==m.end())
            ans=(ans*(it.second+1))%mod;
            continue;
        }
        ll p=it.second;
        ll q=0;
        if(m.find({-it.first.second,it.first.first})!=m.end());
        {
            q=m[{-it.first.second,it.first.first}];
        }
       
        ll res=(powe[p]-1+powe[q]-1+mod)%mod;
        ans=(ans*(res+1))%mod;
    }
    ans=(ans*(ct2+1))%mod;
    if(ct1>0)
    ans++;
    cout<<(ans-1+mod)%mod;
    
}
//  [python]
from collections import Counter
import sys
import math
from functools import cmp_to_key

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)


def main():
    n = int(input())
    p = [tuple(map(int, input().split())) for i in range(n)]
    a = {}
    b = {}
    c = 0
    for x, y in p:
        if x == y == 0:
            c += 1
            continue
        if y == 0:
            if x > 0:
                a[(0, 1)] = a.get((0, 1), 0) + 1
            else:
                b[(0, 1)] = b.get((0, 1), 0) + 1

        g = math.gcd(x, y)
        if x * y > 0:
            x = abs(x)
            y = abs(y)
            a[(x//g, y//g)] = a.get((x//g, y//g), 0) + 1
        else:
            x = abs(x)
            y = abs(y)
            b[(y//g, x//g)] = b.get((y//g, x//g), 0) + 1

    ans = 1
    s = 0
    for k, v in a.items():
        if k in b:
            s += v + b[k]
            ans *= pow(2, v) + pow(2, b[k]) - 1
            ans %= mod
    ans *= pow(2, n - s - c, mod)
    print((ans - 1 + c) % mod)

main()
//  [python]
from collections import Counter
import sys
import math
from functools import cmp_to_key

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)


def main():
    n = int(input())
    p = [tuple(map(int, input().split())) for i in range(n)]
    a = {}
    b = {}
    c = 0
    for x, y in p:
        if x == y == 0:
            c += 1
            continue
        if y == 0:
            if x > 0:
                a[(0, 1)] = a.get((0, 1), 0) + 1
            else:
                b[(0, 1)] = b.get((0, 1), 0) + 1

        g = math.gcd(x, y)
        if x * y > 0:
            x = abs(x)
            y = abs(y)
            a[(x//g, y//g)] = a.get((x//g, y//g), 0) + 1
        else:
            x = abs(x)
            y = abs(y)
            b[(y//g, x//g)] = b.get((y//g, x//g), 0) + 1

    ans = 1
    s = 0
    for k, v in a.items():
        if k in b:
            s += v + b[k]
            ans *= pow(2, v) + pow(2, b[k]) - 1
            ans %= mod
    ans *= pow(2, n - s - c, mod)
    print((ans - 1) % mod)

main()
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

using LL = long long;
const LL MOD = (LL)1e9 + 7;
const LL NS = (LL)2e5 + 4;
LL N;
LL A[NS], B[NS], tpow[NS];
map < pair < LL, LL >, LL > cnt;

int main(){
    tpow[0] = 1;
    for(int i = 1; i < NS; ++i){
        tpow[i] = tpow[i - 1] * 2 % MOD;
    }
    for(int i = 0; i < NS; ++i){
        --tpow[i];
        if(tpow[i] < 0) tpow[i] += MOD;
    }
    scanf("%lld", &N);
    LL ans = 1;
    for(LL i = 0; i < N; ++i){
        scanf("%lld %lld", A + i, B + i);
        if(A[i] == B[i] && !A[i]){
            ++ans;
            continue;
        }
        if(B[i] == 0){
            ++cnt[{(LL)3e18, (LL)3e18}];
            continue;
        }
        LL absA = abs(A[i]), absB = abs(B[i]);
        LL gcd = __gcd(absA, absB);
        if(B[i] < 0){
            B[i] *= -1, A[i] *= -1;
        }
        if(A[i] == 0){
            B[i] = 1; gcd = 1;
        }
        ++cnt[{A[i] / gcd, B[i] / gcd}];
    }
    for(auto&div:cnt){
        if(!div.second){
            continue;
        }
        if(!div.first.first){
            ans *= tpow[div.second] + tpow[cnt[{(LL)3e18, (LL)3e18}]] + 1;
            ans %= MOD;
            div.second = cnt[{(LL)3e18, (LL)3e18}] = 0;
            continue;
        }
        pair < LL, LL > now = div.first;
        pair < LL, LL > op = {now.second, -now.first};
        if(op.second < 0){
            op.first *= -1, op.second *= -1;
        }
        LL absA = abs(op.first), absB = abs(op.second);
        LL gcd = __gcd(absA, absB);
        op = {op.first / gcd, op.second / gcd};
        ans *= tpow[div.second] + tpow[cnt[op]] + 1;
        div.second = cnt[op] = 0;
        ans %= MOD;
    }
    --ans;
    if(ans < 0) ans += MOD;
    printf("%lld\n", ans);
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

using LL = long long;
const LL MOD = (LL)1e9 + 7;
const LL NS = (LL)2e5 + 4;
LL N;
LL A[NS], B[NS], tpow[NS];
map < pair < LL, LL >, LL > cnt;

int main(){
    tpow[0] = 1;
    for(int i = 1; i < NS; ++i){
        tpow[i] = tpow[i - 1] * 2 % MOD;
    }
    for(int i = 0; i < NS; ++i){
        --tpow[i];
        if(tpow[i] < 0) tpow[i] += MOD;
    }
    scanf("%lld", &N);
    LL ans = 1;
    for(LL i = 0; i < N; ++i){
        scanf("%lld %lld", A + i, B + i);
        if(A[i] == B[i] && !A[i]){
            ++ans;
            continue;
        }
        if(B[i] == 0){
            ++cnt[{(LL)3e18, (LL)3e18}];
            continue;
        }
        LL absA = abs(A[i]), absB = abs(B[i]);
        LL gcd = __gcd(absA, absB);
        if(B[i] < 0){
            B[i] *= -1, A[i] *= -1;
        }
        if(A[i] == 0){
            B[i] = 1;
        }
        ++cnt[{A[i] / gcd, B[i] / gcd}];
    }
    for(auto&div:cnt){
        if(!div.first.second){
            continue;
        }
        if(!div.first.first){
            ans *= tpow[div.second] + tpow[cnt[{(LL)3e18, (LL)3e18}]] + 1;
            ans %= MOD;
            div.second = cnt[{MOD, MOD}] = 0;
            continue;
        }
        pair < LL, LL > now = div.first;
        pair < LL, LL > op = {now.second, -now.first};
        if(op.second < 0){
            op.first *= -1, op.second *= -1;
        }
        LL absA = abs(op.first), absB = abs(op.second);
        LL gcd = __gcd(absA, absB);
        op = {op.first / gcd, op.second / gcd};
        ans *= tpow[div.second] + tpow[cnt[op]] + 1;
        div.second = cnt[op] = 0;
        ans %= MOD;
    }
    --ans;
    if(ans < 0) ans += MOD;
    printf("%lld\n", ans);
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

using LL = long long;
const LL MOD = (LL)1e9 + 7;
const LL NS = (LL)2e5 + 4;
LL N;
LL A[NS], B[NS], tpow[NS];
map < pair < LL, LL >, LL > cnt;

int main(){
    tpow[0] = 1;
    for(int i = 1; i < NS; ++i){
        tpow[i] = tpow[i - 1] * 2 % MOD;
    }
    for(int i = 0; i < NS; ++i){
        --tpow[i];
        if(tpow[i] < 0) tpow[i] += MOD;
    }
    scanf("%lld", &N);
    LL ans = 1;
    for(LL i = 0; i < N; ++i){
        scanf("%lld %lld", A + i, B + i);
        if(A[i] == B[i] && !A[i]){
            ++ans;
            continue;
        }
        if(B[i] == 0){
            ++cnt[{(LL)3e18, (LL)3e18}];
            continue;
        }
        LL absA = abs(A[i]), absB = abs(B[i]);
        LL gcd = __gcd(absA, absB);
        if(B[i] < 0){
            B[i] *= -1, A[i] *= -1;
        }
        ++cnt[{A[i] / gcd, B[i] / gcd}];
    }
    for(auto&div:cnt){
        if(!div.first.second){
            continue;
        }
        if(!div.first.first){
            ans *= tpow[div.second] + tpow[cnt[{(LL)3e18, (LL)3e18}]] + 1;
            ans %= MOD;
            div.second = cnt[{MOD, MOD}] = 0;
            continue;
        }
        pair < LL, LL > now = div.first;
        pair < LL, LL > op = {now.second, -now.first};
        if(op.second < 0){
            op.first *= -1, op.second *= -1;
        }
        LL absA = abs(op.first), absB = abs(op.second);
        LL gcd = __gcd(absA, absB);
        op = {op.first / gcd, op.second / gcd};
        ans *= tpow[div.second] + tpow[cnt[op]] + 1;
        div.second = cnt[op] = 0;
        ans %= MOD;
    }
    --ans;
    if(ans < 0) ans += MOD;
    printf("%lld\n", ans);
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

#define HASH 100003
#define Mod 1000000007

typedef struct List {
	struct List *next;
	long long a, b;
	int num;
} list;

long long gcd(long long a, long long b)
{
	if (a > b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	if (b % a == 0) return a;
	else return gcd(b % a, a);
}

int main()
{
	int h, i, N;
	long long A, B, G;
	list *p, *hash[HASH] = {}, d[200010];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%lld %lld", &A, &B);
		if (A != 0 && B != 0) {
			G = gcd(llabs(A), llabs(B));
			A /= G;
			B /= G;
			if (A < 0) {
				A *= -1;
				B *= -1;
			}
		} else if (A != 0) A = 1;
		else if (B != 0) B = -1;
		
		h = (A % HASH - B % HASH * 397 + HASH * 397) % HASH;
		for (p = hash[h]; p != NULL; p = p->next) if (p->a == A && p->b == B) break;
		if (p != NULL) p->num++;
		else {
			d[i].a = A;
			d[i].b = B;
			d[i].num = 1;
			d[i].next = hash[h];
			hash[h] = &(d[i]);
		}
	}
	
	long long ans = 1, zero = 0, pow[200010], tmp;
	list *q, *r;
	for (i = 1, pow[0] = 1; i <= N; i++) pow[i] = pow[i-1] * 2 % Mod;
	for (h = 0; h < HASH; h++) {
		for (p = hash[h]; p != NULL; p = p->next) {
			if (p->num > 0) {
				if (p->a == 0 && p->b == 0) zero += p->num;
				else {
					tmp = (p->b < 0)? p->a: -(p->a);
					i = (llabs(p->b) % HASH - tmp % HASH * 397 + HASH * 397) % HASH;
					for (q = hash[i]; q != NULL; q = q->next) if (q->a == llabs(p->b) && q->b == tmp) break;
					if (q == NULL) ans = ans * pow[p->num] % Mod;
					else {
						ans = ans * (pow[p->num] + pow[q->num] - 1) % Mod;
						q->num = 0;
					}
				}
			}
		}
	}
	printf("%lld\n", (ans + zero + Mod - 1) % Mod);
	fflush(stdout);
	return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
const long mod = 1000000007;
long gcd(long a, long b){return b?gcd(b,a%b):a;}
long modpow(long x, long y, long m){
	long res = 1, tmp = x;
	while(y){
		if(y&1)res = res * tmp % m;
		tmp = tmp * tmp % m;
		y >>= 1;
	}
	return res;
}
long pom(long x, long y){return modpow(x, y, mod);}
typedef struct{
	long x, y;
}cor;
bool cor_lt(cor u, cor v){
	if(u.x < v.x)return true;
	if(u.x == v.x && u.y > v.y)return true;
	return false;
}
bool cor_eq(cor u, cor v){
	return u.x==v.x && u.y==v.y;
}
bool cor_gt(cor u, cor v){
	return !cor_lt(u, v) && !cor_eq(u, v);
}
int cmp(const void *a, const void *b){
	cor u = *(cor*)a, v = *(cor*)b;
	return cor_lt(u, v)?1:cor_eq(u, v)?0:-1;
}
int N, cnt_zero = 0;
long ans = 1;
cor A[1<<18];
int lower_bound(cor u){
	int l = -1, r = N;
	while(r - l > 1){
		int mid = (r + l) / 2;
		if(cor_gt(A[mid], u))l = mid;
		else r = mid;
	}
	return r;
}
int upper_bound(cor u){
	int l = -1, r = N;
	while(r - l > 1){
		int mid = (r + l) / 2;
		if(cor_lt(A[mid], u))r = mid;
		else l = mid;
	}
	return r;
}
int main(){
	scanf("%d", &N);
	for(int i=0; i<N; i++){
		long s, t;
		scanf("%ld%ld", &s, &t);
		if(t < 0){
			s *= -1;
			t *= -1;
		}
		if(s == 0){
			if(t) t = 1;
			else {
				cnt_zero++;
				i--;
				N--;
			}
		}else if(t == 0){
			s = 1;
		}else {
			long x = gcd(labs(s), labs(t));
			s /= x;
			t /= x;
		}
		if(true){
			A[i].x = s;
			A[i].y = t;
		}
	}
	qsort(A, N, sizeof(cor), cmp);
	if(N){
		int cnt = 1, i = 1;
		cor tmp;
		for(; i<N && A[i].x > 0; i++){
			if(cor_eq(A[i], A[i-1]))cnt++;
			else{
				tmp.x = A[i-1].y;
				tmp.y = -A[i-1].x;
				if(tmp.y < 0){
					tmp.x *= -1;
					tmp.y *= -1;
				}
				ans = ans * (pom(2, cnt) + pom(2, upper_bound(tmp) - lower_bound(tmp)) - 1) % mod;
				cnt = 1;
			}
		}
		tmp.x = A[i-1].y;
		tmp.y = -A[i-1].x;
		if(tmp.y < 0){
			tmp.x *= -1;
			tmp.y *= -1;
		}
		ans = ans * (pom(2, cnt) + pom(2, upper_bound(tmp) - lower_bound(tmp)) - 1) % mod;
		cnt = 1;
		for(i += A[i-1].x > 0; i<N; i++){
			if(cor_eq(A[i], A[i-1]))cnt++;
			else{
				tmp.x = A[i-1].y;
				tmp.y = -A[i-1].x;
				if(tmp.y < 0){
					tmp.x *= -1;
					tmp.y *= -1;
				}
				if(upper_bound(tmp) == lower_bound(tmp)){
					ans = ans * pom(2, cnt) % mod;
				}
				cnt = 1;
			}
		}
		tmp.x = A[i-1].y;
		tmp.y = -A[i-1].x;
		if(tmp.y < 0){
			tmp.x *= -1;
			tmp.y *= -1;
		}
		if(upper_bound(tmp) == lower_bound(tmp))ans = ans * pom(2, cnt) % mod;
	}
	ans = (ans + cnt_zero - 1 + mod) % mod;
	printf("%ld\n", ans);
	return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

#define HASH 100003
#define Mod 1000000007

typedef struct List {
	struct List *next;
	long long a, b;
	int num;
} list;

long long gcd(long long a, long long b)
{
	if (a > b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	if (b % a == 0) return a;
	else return gcd(b % a, a);
}

int main()
{
	int h, i, N;
	long long A, B, G;
	list *p, *hash[HASH] = {}, d[200010];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%lld %lld", &A, &B);
		if (A != 0 && B != 0) {
			G = gcd(llabs(A), llabs(B));
			A /= G;
			B /= G;
			if (A < 0) {
				A *= -1;
				B *= -1;
			}
		} else if (A != 0) A = 1;
		else if (B != 0) B = -1;
		
		h = (A % HASH - B % HASH * 397 + HASH * 397) % HASH;
		for (p = hash[h]; p != NULL; p = p->next) if (p->a == A && p->b == B) break;
		if (p != NULL) p->num++;
		else {
			d[i].a = A;
			d[i].b = B;
			d[i].num = 1;
			d[i].next = hash[h];
			hash[h] = &(d[i]);
		}
	}
	
	long long ans = 1, pow[200010], tmp;
	list *q, *r;
	for (i = 1, pow[0] = 1; i <= N; i++) pow[i] = pow[i-1] * 2 % Mod;
	for (h = 0; h < HASH; h++) {
		for (p = hash[h]; p != NULL; p = p->next) {
			if (p->num > 0) {
				if (p->a == 0 && p->b == 0) {
					for (q = hash[1]; q != NULL; q = q->next) if (q->b == 0) break;
					for (r = hash[397]; r != NULL; r = r->next) if (r->a == 0) break;
					tmp = p->num + 1;
					if (q != NULL) {
						tmp += pow[q->num] - 1;
						q->num = 0;
					}
					if (r != NULL) {
						tmp += pow[r->num] - 1;
						r->num = 0;
					}
					ans = ans * tmp % Mod;
				} else {
					tmp = (p->b < 0)? p->a: -(p->a);
					i = (llabs(p->b) % HASH - tmp % HASH * 397 + HASH * 397) % HASH;
					for (q = hash[i]; q != NULL; q = q->next) if (q->a == llabs(p->b) && q->b == tmp) break;
					if (q == NULL) ans = ans * pow[p->num] % Mod;
					else {
						ans = ans * (pow[p->num] + pow[q->num] - 1) % Mod;
						q->num = 0;
					}
				}
			}
		}
	}
	printf("%lld\n", (ans + Mod - 1) % Mod);
	fflush(stdout);
	return 0;
}
//  [javascript]
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

function gcd(a,b){return b?gcd(b,a%b):a;}

var mod = 1e9+7;
function mul(a,b){return ((a>>16)*b%mod*65536+(a&65535)*b)%mod;}
function pow(a,n){for(var r=1;n;a=mul(a,a),n>>=1)if(n&1)r=mul(a,r);return r;}
function mput(n){return (n%mod+mod)%mod;}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var n = next();
  var az = 0, bz = 0, z = 0;
  var map = new Map();
  for(var i = 0; i < n; i++){
    var a = nextbig(), b = nextbig();
    if(a === 0n && b === 0n){z++; continue;}
    if(a === 0n){az++; continue;}
    if(b === 0n){bz++; continue;}
    var c = gcd(a,b);
    a /= c, b /= c;
    if(a < 0)a = -a, b = -b;
    if(map.has(a)){
      if(map.get(a).has(b))map.get(a).set(b,map.get(a).get(b)+1);
      else map.get(a).set(b,1);
    }else{
      map.set(a,new Map());
      map.get(a).set(b,1);
    }
  }
  var ans = pow(2,az) + pow(2,bz) - 1;
  for(var [i0,i1] of map){
    for(var [j0,j1] of i1){
      var t = 0;
      if(j0 < 0){
        if(map.has(-j0) && map.get(-j0).has(i0))continue;
      }else{
        if(map.has(j0) && map.get(j0).has(-i0))t = pow(2,map.get(j0).get(-i0))-1;
      }
      t += pow(2,j1);
      ans = mul(ans,t);
    }
  }
  return mput(ans-1+z);
}