#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <map>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>

using namespace std;


int nbit(int b, int n)
{

	for (int i = 1; i < n; i++) {
		b /= 2;
	}
	return (b % 2);
}

int get_bitlen(int b)
{
	return ((int)(log(b) / log(2) + 1));
}

int main(void)
{
	int n;
	int a[100];
	int ma = 0;
	int res;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		ma = max(ma, a[i]);
	}

	if(get_bitlen(ma) == 1) {
		res = 0;
		goto next;
	}

	for (int i = get_bitlen(ma); i >= 1; i--) {
		for (int j = 0; j < n; j++) {
			if (nbit(a[j], i) == 0) {
				res = (int)pow(2, i - 1);
				goto next;
			}
		}
	}
	next:


	cout << res << endl;

	return (0);
}