#include <bits/stdc++.h>
#include <random>
#include <chrono>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename T> void _do(T x){cerr<<x<<"\n";}
template<typename T,typename ...U> void _do(T x,U ...y){cerr<<x<<", ";_do(y...);}
#define dbg(...) cerr<<#__VA_ARGS__<<" = ";_do(__VA_ARGS__);

const int MOD1=1e9+7;
const int MOD2=998244353;
const ll INF=2e18;
const ld PI=3.14159265358979323846;
ll gcd(ll a,ll b){if(b==0) return a; return gcd(b,a%b);}
ll fpow(ll a,ll b,ll m)
{
    if(!b) return 1;
    ll ans=fpow(a*a%m,b/2,m);
    return (b%2?ans*a%m:ans);
}
ll inv(ll a,ll m) {return fpow(a,m-2,m);}

#define MottoHayaku ios::sync_with_stdio(false);cin.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(int i=m;i<n;i++)
#define F first
#define S second
#define pb push_back
#define SZ(a) ((ll)a.size())
#define reset(a) memset(a,0,SZ(a))
#define cd(a,b) ((a+b-1)/b)
#define pow2(a) (1LL<<a)
#define LB(a,x) (lower_bound(a.begin(),a.end(),x))
#define LPOS(a,x) (lower_bound(a.begin(),a.end(),x)-a.begin())
#define UB(a,x) (upper_bound(a.begin(),a.end(),x))
#define UPOS(a,x) (upper_bound(a.begin(),a.end(),x)-a.begin())
#define uni(c) c.resize(distance(c.begin(),unique(c.begin(),c.end())))
#define unisort(c) sort(c.begin(),c.end()),uni(c)
ll a[105],dp[105][100005];
signed main()
{
    MottoHayaku
    ll n,sum=0;
    cin>>n;
    rep1(i,n)
    {
        cin>>a[i];
        sum+=a[i];
        dp[i][0]=1;
        rep1(j,100000)
        {
            dp[i][j]=dp[i-1][j];
            if(j>=a[i]) dp[i][j]|=dp[i-1][j-a[i]];
        }
    }
    ll ans=0;
    for(int i=sum/2;i>=0;i--)
    {
        if(dp[n][i])
        {
            ans=sum-i;
            break;
        }
    }
    cout<<ans<<"\n";
}

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

//#include <atcoder/convolution>
//#include <atcoder/modint> 
//using Modint = atcoder::modint998244353;

using namespace std;
typedef long long ll;

void ex_gcd(ll a, ll b, ll &d, ll &x, ll &y) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    ex_gcd(b, a % b, d, y, x);
    y -= a / b * x;
  }
}
ll inv(ll a, ll n) {
  ll d, x, y;
  ex_gcd(a, n, d, x, y);
  return d == 1 ? (x % n + n) % (n / d) : -1;
}
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}

const int maxn = 1000005;
const int mod = 998244353;

vector<int>prim;
bool b[maxn];
void init(){
  for(int i=2;i<maxn;i++){
    if(!b[i]){
      prim.push_back(i);
      for(int j=i+i;j<maxn;j+=i)b[j]=1;
    }
  }
}

vector<int>p,c;
void dfs(int pos, int cur, int cnt, int l, int r, int& sum){
  if(cur>r)return;
  if(pos==p.size()){
    if(cnt==0)return;
    int tt = r/cur-(l-1)/cur;
    if(cnt&1)sum += tt;
    else sum -= tt;
    return;
  }
  dfs(pos+1, cur * p[pos], cnt+1, l,r,sum);
  dfs(pos+1, cur, cnt, l, r, sum);
}
void dfs2(int pos, int cur, int l, int r, int&sum){
  if(cur>r)return;
  if(pos==p.size()){
    if(cur>=l&&cur<=r)sum++;
    return;
  }
  int tt = 1;
  for(int i=0;i<=c[pos];i++){
    dfs2(pos+1, cur*tt, l,r,sum);
    tt*=p[pos];
  }
}
int solve(int l, int x) {
  if(l>=x)return 0;
  p.clear();
  c.clear();
  int cur = x;
  for(int i=0;prim[i]*prim[i]<=cur;i++){
    int tt = prim[i];
    if(cur%tt==0){
      int cnt = 0;
      while(cur%tt==0){
        cur/=tt;
        cnt++;
      }
      p.push_back(tt);
      c.push_back(cnt);
    }
  }
  if(cur>1){
    p.push_back(cur);
    c.push_back(1);
  }
  int sum = 0;
  dfs(0,1,0,l,x-1,sum);
  int sum2=0;
  dfs2(0,1,l,x-1,sum2);
  return sum-sum2;
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  init();
  int l,r;
  cin>>l>>r;
  ll ret = 0;
  for(int i=l+1;i<=r;i++){
    ret += solve(max(2, l), i);
  }
  cout<<ret*2<<endl;
  return 0;
}