
///  ~~~~~Bismillah'hir Rah'manir Rahim~~~~~  ///

/*  "  Allah(SWT) blesses with knowledge whom he wants. "   */
/*  " Indeed with Hardship, comes Ease. "    */


#include<bits/stdc++.h>
using namespace std ;

#define  Fast      ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ULL       unsigned long long
#define  LL         long long
#define ST          string

#define  F           first
#define  S           second
#define  PB        push_back
#define  MP       make_pair

#define  pi         acos(-1.0)

///for Unordered map
/* mpp.max_load_factor(0.25); mpp.reserve(1024); */
/* cout << fixed << setprecision(12);*/


int main ()
{
    int t, n, i, j, x, y, sum=0 ;
    //double p, q ;
    //char c ;
    string s, s1, s2 ;
    //cin>>t ;
    //while(t--)
    //{
    cin>>n ;
    int a[n+5] , b[n+5] , c[n+5] ;

    //}
    for(i=1; i<=n; i++)
    {
        cin>>a[i] ;
        if(a[i]>10) sum+=(a[i]-10) ;
    }
    cout<<sum ;


    return 0 ;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <tuple>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <array>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>
#include <chrono>
using ll = long long;
using std::cin;
using std::cout;
using std::endl;
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 int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

void solve()
{
  int n; cin >> n;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i)
  {
    cin >> a[i];
  }
  ll res = INF;
  for (int S = 0; S < (1 << n); ++S)
  {
    if(~S >> (n - 1) & 1)
      continue;
    int XOR = 0;
    int OR = 0;
    for (int i = 0; i < n; ++i)
    {
      OR |= a[i];
      if(S >> i & 1)
      {
        XOR ^= OR;
        OR = 0;
      }
    }
    chmin(res, (ll)XOR);
  }
  cout << res << "\n";
}
int main()
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);


  int kkt = 1;
  //cin >> kkt;
  while(kkt--)
  {
    solve();
  }
  return 0;
}
