using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; namespace Solver { class Program { const int M = 1000000007; static void Main() { var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Scan sc = new Scan(); int n = sc.Int(); int k = 61; long[] a = sc.LongArray(); MaxFlow mf = new MaxFlow(n + k + 2); for (int i = 0; i < n; ++i) { mf.add_edge(0, i + 1, 1, true); for (int j = 0; j < k; ++j) if ((a[i] >> j) % 2 == 1) mf.add_edge(i + 1, n + j + 1, 1, true); } for (int i = 0; i < k; ++i) mf.add_edge(n + i + 1, n + k + 1, 1, true); sw.WriteLine((long)1 << mf.run(0, n + k + 1)); sw.Flush(); } } class Scan { public int Int() { return int.Parse(Console.ReadLine().Trim()); } public long Long() { return long.Parse(Console.ReadLine().Trim()); } public string Str() { return Console.ReadLine().Trim(); } public int[] IntArray() { return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray(); } public void IntTwi(out int a, out int b) { int[] arr = IntArray(); a = arr[0]; b = arr[1]; } public void LongTwi(out long a, out long b) { long[] arr = LongArray(); a = arr[0]; b = arr[1]; } public void StrTwi(out string a, out string b) { string[] arr = StrArray(); a = arr[0]; b = arr[1]; } public long[] LongArray() { return Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); } public string[] StrArray() { return Console.ReadLine().Trim().Split(); } } class MaxFlow { class edge { public int to, cap, rev; } int V; List[] G; int[] itr, level; public MaxFlow(int V) // V : ten no kazu { this.V = V; G = new List[V]; for (int i = 0; i < V; ++i) G[i] = new List(); } public void add_edge(int from, int to, int cap, bool IsDirection) { G[from].Add(new edge { to = to, cap = cap, rev = G[to].Count }); if (IsDirection) G[to].Add(new edge { to = from, cap = 0, rev = G[from].Count - 1 }); else G[to].Add(new edge { to = from, cap = cap, rev = G[from].Count - 1 }); } void bfs(int s) { level = new int[V]; for (int i = 0; i < V; ++i) level[i] = -1; Queue q = new Queue(); level[s] = 0; q.Enqueue(s); while (q.Count > 0) { int v = q.Dequeue(); foreach (edge e in G[v]) { if (e.cap > 0 && level[e.to] < 0) { level[e.to] = level[v] + 1; q.Enqueue(e.to); } } } } int dfs(int v, int t, int f) { if (v == t) return f; for (int i = itr[v]; i < (int)G[v].Count; ++i) { edge e = G[v][i]; if (e.cap > 0 && level[v] < level[e.to]) { int d = dfs(e.to, t, Math.Min(f, e.cap)); if (d > 0) { e.cap -= d; G[e.to][e.rev].cap += d; return d; } } } return 0; } public int run(int s, int t) { int ret = 0, f; bfs(s); while (level[t] >= 0) { itr = new int[V]; while ((f = dfs(s, t, Int32.MaxValue)) > 0) ret += f; bfs(s); } return ret; } } }