#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
typedef long long ll;
string intToA(int n,int radix){
    string ans="";
    do{
        int t=n%radix;
        if(t>=0&&t<=9)ans+=t+'0';
        else ans+=t-10+'a';
        n/=radix;
    }while(n!=0);
    reverse(ans.begin(),ans.end());
    return ans;    
}
const int maxn = 1e3 + 5; 
int res[100086] = {0};
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	res[1] = 1;
	for(int i = 2;i<=100000;i++){
		string w1 = intToA(i,10);
		string w2 = intToA(i,8);
		//cout << w1 << w2 <<endl;
		if(w1.find('7')!=w1.npos || w2.find('7')!=w2.npos){
			res[i] = res[i-1];
		}else{
			res[i] = res[i-1]+1;
		}
	}
	int k;
	cin >> k;
	cout << res[k] << endl;
	return 0;
}
#include<iostream>
#include<algorithm>
#include<cmath>
#include<numeric>
#include<vector>
#include<map>
#include<climits>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto &e: a) cin >> e;
    int ans = INT_MAX;
    for(int i = 0; i < 1 << n; i++){
        int xored = 0, ored = 0;
        for(int j = 0; j < n; j++){
            ored |= a[j];
            if(j == n - 1 || (i >> j) & 1){
                xored ^= ored;
                ored = 0;
            }
        }
        ans = min(ans, xored);
    }

    cout << ans << endl;
    return 0;
}

