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

int gcd(int a,int b) {return b==0?a:gcd(b,a%b);}
const int maxn = 1000005;
int prime[maxn],np[maxn],mu[maxn],tot=0;
void init(int n) {
   np[1]=mu[1]=1;
   for(int i=2;i<=n;++i) {
       if(!np[i]) prime[++tot]=i,mu[i]=-1;
       for(int j=1;j<=tot;++j) {
           if(i*prime[j]>n) break;
           if(i%prime[j]==0) {
               np[i*prime[j]]=1;
               mu[i*prime[j]]=0;
               break;
           }
           np[i*prime[j]]=1;
           mu[i*prime[j]]=-mu[i];
       }
   }
}
int main() {
    int l, r;
    cin >> l >> r;
    init(r);
    auto solve = [&](int a, int b) -> ll {
        // [1, a] [1, b]
        // sum_{d=1}^{max(a,b)} \mu(d) (a/d) * (b/d)
        ll ret = 0;
        for(int d = 1; d <= a; ++d) {
            if(mu[d]) ret += 1ll * mu[d] * (a / d) * (b / d);
        }
        return ret;
    };
    ll ans = 0;
    for(int g = 2; g <= r; ++g) {
        int a = max(2, (l + g - 1) / g), b = r / g;
        if(a > b) break;
        ll tmp = solve(b, b) + solve(a - 1, a - 1) - 2 * solve(a - 1, b);
        // a <= l, r <= b
        // l = r = 1
        ans += tmp / 2 * 2;
    }
    cout << ans << '\n';
}
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
    
#define ll long long int
#define pb push_back
#define eb emplace_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--) 
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<double>	vd;
typedef vector<bool>	vb;
typedef pair<ll,ll> 	pll;
typedef vector<vector<ll>> vvll;
#define br "\n"
#define ff first
#define ss second
#define debug(a...) cout<<#a<<": ";for(auto it:a)cout<<it<<" ";cout<<endl;
#define MAXIM 1000101
const ll MAX = 2e5 + 1;
ll mod = 1e9 + 7;

ll n;

ll cal(vll &v,ll m){
    ll co = 0;
    ll ans = 0;
    rep(i,0,n){
        co |= v[i];
        if(((1LL<<i)&m)){
            (ans ^= co);
            co = 0;
        }
    }
    (ans ^= co);
    return ans;
}

void solve(){
    cin >> n;
    vll v(n);
    ll ans = 0;
    rep(i,0,n){
        cin >> v[i];
        ans |= v[i];
    }
    rep(i,0,(1<<n)){
        ans = min(cal(v,i),ans);
    }
    cout << ans << br;
}   
 
int main(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
 
    ll t = 1;
    // cin >> t;
    rep(i,0,t){
        // cout << "Case #" << i + 1 << ": ";
        solve();
        // test();
    }
}