//Let's join Kaede Takagaki Fan Club !!
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <chrono>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define int long long
#define L __int128
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define a first
#define b second
#define fi first
#define sc second
#define rng(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
#define si(x) int(x.size())
 
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif
 
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b;return true;}else return false;}
template<class t,class u> bool chmin(t&a,u b){if(b<a){a=b;return true;}else return false;}
 
template<class t> using vc=vector<t>;
 
template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.fi<<","<<p.sc<<"}";
}
 
template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}
 
template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 998244353;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}
ll modpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}
#define sz 10005
ll F[sz],R[sz];
void make(){
	F[0] = 1;
	for(int i=1;i<sz;i++) F[i] = F[i-1]*i%mod;
	for(int i=0;i<sz;i++) R[i] = modpow(F[i],mod-2);
}
ll C(int a,int b){
	if(b < 0 || a < b) return 0;
	return F[a]*R[b]%mod*R[a-b]%mod;
}
int a[105], n, dp[2][105][5005];
void solve(){
	cin >> n;
	repn(i, n) cin >> a[i];
	dp[0][0][0] = 1;
	int cur = 0, nxt = 1;
	repn(i, n){
		memset(dp[nxt], 0, sizeof(dp[nxt]));
		rep(num, i){
			rep(sum, 5005){
				if(dp[cur][num][sum] == 0) continue;
				dp[nxt][num][sum] += dp[cur][num][sum];
				if(sum+a[i]>=5005) continue;
				dp[nxt][num+1][sum+a[i]] += dp[cur][num][sum];
			}
		}
		rep(i, 105) rep(j, 5005) dp[nxt][i][j]%=mod;
		swap(cur, nxt);
	}
	make();
	int sum = 0; repn(i, n) sum += a[i];
	if(sum & 1) o(0);
	else{
		int ans = 0;
		rep(i, 105){
			ans += dp[cur][i][sum/2] * F[i] % mod * F[n-i] % mod;
		}
		o(ans%mod);
	}
}
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	int t; t = 1; //cin >> t;
	while(t--) solve();
}

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define ud unsigned int
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x3f
#define MAX_INF_VAL 0x3f3f3f3f
#define MAX_INF_VAL_LL 0x3f3f3f3f3f3f3f3f
//#define pi 3.141592653589
#define eps 1e-9
#define F(x) ((x)/3+((x)%3==1?0:tb))
#define G(x) ((x)<tb?(x)*3+1:((x)-tb)*3+2)
//#define p 2173412051LL
//#define sz 2

using namespace std;

template< typename T > void read( T &x ) {
	x = 0;
	char ch = getchar();
	ll f = 1;
	while( !isdigit( ch ) ) {
		if( ch == '-' )
		f *= -1;
		ch = getchar();
	}
	while( isdigit( ch ) ) {
		x = x * 10 + ch - 48;
		ch = getchar();
	}
	x *= f;
}

struct custom_hash {
    static uint64_t splitmix64( uint64_t x ) {
        x += 0x9e3779b97f4a7c15;
        x = ( x ^ ( x >> 30 ) ) * 0xbf58476d1ce4e5b9;
        x = ( x ^ ( x >> 27 ) ) * 0x94d049bb133111eb;
        return x ^ ( x >> 31 );
    }

    size_t operator() ( uint64_t x ) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64( x + FIXED_RANDOM );
    }
};

const int N = 1000010;

int num;
bool vis[ N ];
int prime[ N ];
int mu[ N ];

void pre( int );

int main() {
	ios::sync_with_stdio( false );
	cin.tie( 0 ), cout.tie( 0 );
	int l, r;
	cin >> l >> r;
	int len = r - l + 1;
	ll ans = 0;
	pre( 1000000 );
	for( int i = 2; i <= r; ++i ) {
		ll tmp = r / i - ( l - 1 ) / i;
		ans -= 1LL * mu[ i ] * tmp * tmp;
	}
	for( int i = max( 2, l ); i <= r; ++i )
		ans -= r / i * 2 - 1;
	cout << ans;
	return 0;
}

void pre( int n ) {
	for( int i = 2; i <= n; ++i ) {
		if( !vis[ i ] ) {
			prime[ num++ ] = i;
			mu[ i ] = -1;
		}
		for( int j = 0; j < num; ++j ) {
			int tmp = prime[ j ] * i;
			if( tmp > n )
				break;
			vis[ tmp ] = true;
			if( i % prime[ j ] == 0 )
				break;
			mu[ tmp ] = -mu[ i ];
		}
	}
}