import scala.io.StdIn.readLine import scala.util.control.Breaks object Main{ def ipow(x : Long,n : Long) : Long = { if(x == 0) 1 else if(n % 2 == 0) ipow(x*x,n/2) else x * ipow(x*x,n/2) } def popcount(x : Long) : Long = { var ret = 0 var xi = x while(xi != 0){ xi = xi & (xi-1) ret = ret + 1 } ret } def to_bit_str(x : Long) : String = { val bi = (0 to 62).map((i : Int) => if ((x & (1L << i)) != 0) "1" else "0" ).reverse bi.map(_.toString).fold("")(_ + _) } def main(args: Array[String]){ val n = readLine().toLong val a = readLine().split(" ").map(_.toLong).sorted.distinct.reverse val MAXK = 62 var i = 0 var used = Set[Int]() for(k <- 0 to MAXK){ val mask = 1L << (MAXK-k) val b = new Breaks b.breakable { for((e,i) <- a.zipWithIndex){ if(!used(i) && (e & mask) != 0){ used = used + i for((c,h) <- a.zipWithIndex){ if(!used(h) && ((c & mask) != 0)){ a(h) = a(h) ^ e } } // println("---------------------------------") // a.map(to_bit_str).foreach(println) // println("---------------------------------") b.break } } } } // println("---------------------------------") // a.map(to_bit_str).foreach(println) // println("---------------------------------") println(ipow(2,a.distinct.count(_ != 0))) } }