#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
//using namespace atcoder;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

#define debug(v) cout<<#v<<": ",prt(v);
template <typename A,typename B>
inline void prt(pair<A,B> p){cout<<"("<<p.first<<", "<<p.second<<")\n";}
template <typename A,typename B,typename C>
inline void prt(tuple<A,B,C> p){cout<<"("<<get<0>(p)<<", "<<get<1>(p)<<", "<<get<2>(p)<<")\n";}
inline void prt(bool p){if(p)cout<<"True"<<'\n';else cout<<"False"<<'\n';}
template <typename T> 
inline void prt(vector<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template<typename T> 
inline void prt(vector<vector<T> >& vv){ for(const auto& v : vv){ prt(v); } }
template <typename T> 
inline void prt(deque<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(unordered_map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(set<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(multiset<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}


int main(){
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	string s;
	cin >> s;
	ll ans = 0;
	rep(i,9){
		if(s.substr(i,4)=="ZONe")ans++;
	}
	cout << ans << endl;


	return 0;
}
// Problem: C - ORXOR
// Contest: AtCoder - AtCoder Beginner Contest 197（Sponsored by Panasonic）
// URL: https://atcoder.jp/contests/abc197/tasks/abc197_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <vector>
#define rep(i, n) for(int i = 1;i <= n;++i)
#define Rep(i, n) for(int i = n;i >= 1;--i)
#define forr(i,m,n) for(int i = m;i <= n;++i)
#define debug cout << "---------------------------\n";
#define endl '\n'
#define IO ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define YES "YES"
#define NO "NO"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
const int maxn = 1e6 + 100;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
 
 
 
// -------------- 板子 -----------------------------

int n;
ll a[30],ans = 1e18;



void dfs(int id,ll p) {
	// cout << id << ' ' << p << endl;
	if(id == n + 1) {
		ans = min(ans,p);
		return ;
	}
	ll cnt = 0;
	for(int i = id;i <= n;++i) {
		cnt |= a[i];
		dfs(i + 1,cnt ^ p);
	}
}


int main() {
	IO
	cin >> n;
	for(int i = 1;i <= n;++i) cin >>a[i];
	dfs(1,0);
	// ll cnt = 0;
	// for(int i = 1;i <= n;++i) {
		// cnt |= a[i];
		// dfs(i+1,cnt);
		// cout << i << " " << cnt << ' ' << ans << endl;
	// }
	cout << ans <<endl;
	return 0;
} 
