/**
    हमने तुम्हे जिस सिद्दत से चाहा वो हम जानते हैं,
    पड़ जिसकी तुम हो उसके मोहब्बत की ताकत क्या रही होगी.
**/
/**

**/

#include <bits/stdc++.h>

#define ll                   long long
#define MOD                  (ll)(1e9 + 7)
#define INF                  (ll)1e18
#define fast()               ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define loop(i,a,b)          for(ll i=(ll)a;i<(ll)b;i++)
#define pool(i,a,b)          for(ll i=(ll)a;i>=(ll)b;i--)
#define pb                   push_back
#define vi                   vector<ll>
#define endl                 "\n"
#define param                greater<ll>()
#define ff                   first
#define ss                   second
#define all(v)               v.begin(),v.end()
#define dbg(x)               cout<<#x<<" is: "<<x<<endl;

using namespace std;

bool isvowel(char c){if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U')return true;return false;}

ll fast_exp(ll x,ll n){ll ans=1;while(n){if(n&1)ans*=x;n=n>>1;x=x*x;}return ans;}

ll mod_exp(ll x, ll y,ll p){ll res = 1;x = x % p;while(y>0){if(y&1)res = (res*x) % p;y = y>>1;x=(x*x)%p;}return res;}

ll sod(ll n){ll sum = 0;    while(n!=0){sum=sum+(n%10);n=n/10;}     return sum;}

ll modInverse(ll a, ll m){  return mod_exp(a, m-2, m);}

ll nCrModpDP(ll n,ll r,ll p)
{
    ll C[r+1];
    memset(C,0,sizeof(C));
    C[0]=1;
    for(ll i=1;i<=n;i++)
    {
        for (ll j=min(i,r);j>0;j--)
            C[j]=(C[j]+C[j-1])%p;
    }
    return C[r];
}

ll nCrModpLucas(ll n,ll r,ll p)
{
    if(r==0)
        return 1;
    ll ni=n%p,ri=r%p;
    return(nCrModpLucas(n/p,r/p,p)*nCrModpDP(ni,ri,p))%p;

    //O(p2 * logp(n))
}

/*End of template */

void solve()
{
    ll n,k;

    cin >> n >> k;

    vector<ll> a(n);
    loop(i,0,n)		cin >> a[i];
    loop(i,0,n)		a[i]=a[i]%k;

    map<ll,ll> mp;
    loop(i,0,n)		mp[a[i]]+=1;

    ll ans = 0;

    if(k%2==0 || k==1)
        cout << (n/2)*2;
    else
    {
        ll x,ans=0;
        for(x=1; x<=k/2; x++)
        {
            ll foo = min(mp[x],mp[k-x]);
            ans+=foo;
        }

        cout << ans*2 + (mp[0]/2)*2;
    }
}

int main()
{

	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif

    fast()

    ll t;
    // cin>>t;
    t=1;
    while(t--)
        solve();

    #ifndef ONLINE_JUDGE
    	cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif

}


/**
    हमने तुम्हे जिस सिद्दत से चाहा वो हम जानते हैं,
    पड़ जिसकी तुम हो उसके मोहब्बत की ताकत क्या रही होगी.
**/
/**

**/

#include <bits/stdc++.h>

#define ll                   long long
#define MOD                  (ll)(1e9 + 7)
#define INF                  (ll)1e18
#define fast()               ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define loop(i,a,b)          for(ll i=(ll)a;i<(ll)b;i++)
#define pool(i,a,b)          for(ll i=(ll)a;i>=(ll)b;i--)
#define pb                   push_back
#define vi                   vector<ll>
#define endl                 "\n"
#define param                greater<ll>()
#define ff                   first
#define ss                   second
#define all(v)               v.begin(),v.end()
#define dbg(x)               cout<<#x<<" is: "<<x<<endl;

using namespace std;

bool isvowel(char c){if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U')return true;return false;}

ll fast_exp(ll x,ll n){ll ans=1;while(n){if(n&1)ans*=x;n=n>>1;x=x*x;}return ans;}

ll mod_exp(ll x, ll y,ll p){ll res = 1;x = x % p;while(y>0){if(y&1)res = (res*x) % p;y = y>>1;x=(x*x)%p;}return res;}

ll sod(ll n){ll sum = 0;    while(n!=0){sum=sum+(n%10);n=n/10;}     return sum;}

ll modInverse(ll a, ll m){  return mod_exp(a, m-2, m);}

ll nCrModpDP(ll n,ll r,ll p)
{
    ll C[r+1];
    memset(C,0,sizeof(C));
    C[0]=1;
    for(ll i=1;i<=n;i++)
    {
        for (ll j=min(i,r);j>0;j--)
            C[j]=(C[j]+C[j-1])%p;
    }
    return C[r];
}

ll nCrModpLucas(ll n,ll r,ll p)
{
    if(r==0)
        return 1;
    ll ni=n%p,ri=r%p;
    return(nCrModpLucas(n/p,r/p,p)*nCrModpDP(ni,ri,p))%p;

    //O(p2 * logp(n))
}

/*End of template */

void solve()
{
    ll n,k;

    cin >> n >> k;

    vector<ll> a(n);
    loop(i,0,n)		cin >> a[i];

    loop(i,0,n)		a[i]=a[i]%k;

    map<ll,ll> mp;

    loop(i,0,n)		mp[a[i]]+=1;

    ll ans = 0;

    // cout << mp[0] << " ";
    // cout << mp[1] << " ";
    // cout << mp[2] << " ";
    // cout << endl;

    ll x;
    for(x=0;x<=k/2;x++)
    	ans = ans + min(mp[x],mp[k-x]);

    ans = ans*2;
    if(k==2)
    	cout << ans + ((n-ans)/2)*2;
    else
    	cout << ans;
}

int main()
{

	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif

    fast()

    ll t;
    // cin>>t;
    t=1;
    while(t--)
        solve();

    #ifndef ONLINE_JUDGE
    	cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif

}


/**
    हमने तुम्हे जिस सिद्दत से चाहा वो हम जानते हैं,
    पड़ जिसकी तुम हो उसके मोहब्बत की ताकत क्या रही होगी.
**/
/**

**/

#include <bits/stdc++.h>

#define ll                   long long
#define MOD                  (ll)(1e9 + 7)
#define INF                  (ll)1e18
#define fast()               ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define loop(i,a,b)          for(ll i=(ll)a;i<(ll)b;i++)
#define pool(i,a,b)          for(ll i=(ll)a;i>=(ll)b;i--)
#define pb                   push_back
#define vi                   vector<ll>
#define endl                 "\n"
#define param                greater<ll>()
#define ff                   first
#define ss                   second
#define all(v)               v.begin(),v.end()
#define dbg(x)               cout<<#x<<" is: "<<x<<endl;

using namespace std;

bool isvowel(char c){if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U')return true;return false;}

ll fast_exp(ll x,ll n){ll ans=1;while(n){if(n&1)ans*=x;n=n>>1;x=x*x;}return ans;}

ll mod_exp(ll x, ll y,ll p){ll res = 1;x = x % p;while(y>0){if(y&1)res = (res*x) % p;y = y>>1;x=(x*x)%p;}return res;}

ll sod(ll n){ll sum = 0;    while(n!=0){sum=sum+(n%10);n=n/10;}     return sum;}

ll modInverse(ll a, ll m){  return mod_exp(a, m-2, m);}

ll nCrModpDP(ll n,ll r,ll p)
{
    ll C[r+1];
    memset(C,0,sizeof(C));
    C[0]=1;
    for(ll i=1;i<=n;i++)
    {
        for (ll j=min(i,r);j>0;j--)
            C[j]=(C[j]+C[j-1])%p;
    }
    return C[r];
}

ll nCrModpLucas(ll n,ll r,ll p)
{
    if(r==0)
        return 1;
    ll ni=n%p,ri=r%p;
    return(nCrModpLucas(n/p,r/p,p)*nCrModpDP(ni,ri,p))%p;

    //O(p2 * logp(n))
}

/*End of template */

void solve()
{
    ll n,k;

    cin >> n >> k;

    vector<ll> a(n);
    loop(i,0,n)		cin >> a[i];

    if(k==1)
    {
    	cout << (n/2)*2 ;
    	return;
    }

    loop(i,0,n)		a[i]=a[i]%k;

    map<ll,ll> mp;

    loop(i,0,n)		mp[a[i]]+=1;

    ll ans = 0;

    // cout << mp[0] << " ";
    // cout << mp[1] << " ";
    // cout << mp[2] << " ";
    // cout << endl;

    ll x;
    for(x=0;x<=k/2;x++)
    	ans = ans + min(mp[x],mp[k-x]);

    ans = ans*2;
    if(k==2)
    	cout << ans + ((n-ans)/2)*2;
    else
    	cout << ans;
}

int main()
{

	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif

    fast()

    ll t;
    // cin>>t;
    t=1;
    while(t--)
        solve();

    #ifndef ONLINE_JUDGE
    	cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif

}


/**
    हमने तुम्हे जिस सिद्दत से चाहा वो हम जानते हैं,
    पड़ जिसकी तुम हो उसके मोहब्बत की ताकत क्या रही होगी.
**/
/**

**/

#include <bits/stdc++.h>

#define ll                   long long
#define MOD                  (ll)(1e9 + 7)
#define INF                  (ll)1e18
#define fast()               ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define loop(i,a,b)          for(ll i=(ll)a;i<(ll)b;i++)
#define pool(i,a,b)          for(ll i=(ll)a;i>=(ll)b;i--)
#define pb                   push_back
#define vi                   vector<ll>
#define endl                 "\n"
#define param                greater<ll>()
#define ff                   first
#define ss                   second
#define all(v)               v.begin(),v.end()
#define dbg(x)               cout<<#x<<" is: "<<x<<endl;

using namespace std;

bool isvowel(char c){if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U')return true;return false;}

ll fast_exp(ll x,ll n){ll ans=1;while(n){if(n&1)ans*=x;n=n>>1;x=x*x;}return ans;}

ll mod_exp(ll x, ll y,ll p){ll res = 1;x = x % p;while(y>0){if(y&1)res = (res*x) % p;y = y>>1;x=(x*x)%p;}return res;}

ll sod(ll n){ll sum = 0;    while(n!=0){sum=sum+(n%10);n=n/10;}     return sum;}

ll modInverse(ll a, ll m){  return mod_exp(a, m-2, m);}

ll nCrModpDP(ll n,ll r,ll p)
{
    ll C[r+1];
    memset(C,0,sizeof(C));
    C[0]=1;
    for(ll i=1;i<=n;i++)
    {
        for (ll j=min(i,r);j>0;j--)
            C[j]=(C[j]+C[j-1])%p;
    }
    return C[r];
}

ll nCrModpLucas(ll n,ll r,ll p)
{
    if(r==0)
        return 1;
    ll ni=n%p,ri=r%p;
    return(nCrModpLucas(n/p,r/p,p)*nCrModpDP(ni,ri,p))%p;

    //O(p2 * logp(n))
}

/*End of template */

void solve()
{
    ll n,k;

    cin >> n >> k;

    vector<ll> a(n);
    loop(i,0,n)		cin >> a[i];
    loop(i,0,n)		a[i]=a[i]%k;

    map<ll,ll> mp;
    loop(i,0,n)		mp[a[i]]+=1;

    ll x,ans=0;
    for(x=1; x<=k/2; x++)
    {
        ll foo = min(mp[x],mp[k-x]);
        ans+=foo;
    }

    cout << ans*2 + (mp[0]/2)*2;
}

int main()
{

	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif

    fast()

    ll t;
    // cin>>t;
    t=1;
    while(t--)
        solve();

    #ifndef ONLINE_JUDGE
    	cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif

}


/**
    हमने तुम्हे जिस सिद्दत से चाहा वो हम जानते हैं,
    पड़ जिसकी तुम हो उसके मोहब्बत की ताकत क्या रही होगी.
**/
/**

**/

#include <bits/stdc++.h>

#define ll                   long long
#define MOD                  (ll)(1e9 + 7)
#define INF                  (ll)1e18
#define fast()               ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define loop(i,a,b)          for(ll i=(ll)a;i<(ll)b;i++)
#define pool(i,a,b)          for(ll i=(ll)a;i>=(ll)b;i--)
#define pb                   push_back
#define vi                   vector<ll>
#define endl                 "\n"
#define param                greater<ll>()
#define ff                   first
#define ss                   second
#define all(v)               v.begin(),v.end()
#define dbg(x)               cout<<#x<<" is: "<<x<<endl;

using namespace std;

bool isvowel(char c){if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U')return true;return false;}

ll fast_exp(ll x,ll n){ll ans=1;while(n){if(n&1)ans*=x;n=n>>1;x=x*x;}return ans;}

ll mod_exp(ll x, ll y,ll p){ll res = 1;x = x % p;while(y>0){if(y&1)res = (res*x) % p;y = y>>1;x=(x*x)%p;}return res;}

ll sod(ll n){ll sum = 0;    while(n!=0){sum=sum+(n%10);n=n/10;}     return sum;}

ll modInverse(ll a, ll m){  return mod_exp(a, m-2, m);}

ll nCrModpDP(ll n,ll r,ll p)
{
    ll C[r+1];
    memset(C,0,sizeof(C));
    C[0]=1;
    for(ll i=1;i<=n;i++)
    {
        for (ll j=min(i,r);j>0;j--)
            C[j]=(C[j]+C[j-1])%p;
    }
    return C[r];
}

ll nCrModpLucas(ll n,ll r,ll p)
{
    if(r==0)
        return 1;
    ll ni=n%p,ri=r%p;
    return(nCrModpLucas(n/p,r/p,p)*nCrModpDP(ni,ri,p))%p;

    //O(p2 * logp(n))
}

/*End of template */

void solve()
{
    ll n,k;

    cin >> n >> k;

    vector<ll> a(n);
    loop(i,0,n)		cin >> a[i];
    loop(i,0,n)		a[i]=a[i]%k;

    map<ll,ll> mp;
    loop(i,0,n)		mp[a[i]]+=1;

    ll ans = 0;

    if(k<=2)
        cout << (n/2)*2;
    else
    {
        ll x,ans=0;
        for(x=1; x<=k/2; x++)
        {
            ll foo = min(mp[x],mp[k-x]);
            ans+=foo;
        }

        cout << ans*2 + (mp[0]/2)*2;
    }
}

int main()
{

	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif

    fast()

    ll t;
    // cin>>t;
    t=1;
    while(t--)
        solve();

    #ifndef ONLINE_JUDGE
    	cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif

}


#include <iostream>

using namespace std;

int main()
{
    int n;
    int k;
    long long x;
    int count = 0;
    long long mods[100];
    for (int i = 0; i < 100; i++)
        mods[i] = 0;
    cin >> n >> k;

    for(int i = 0; i < n; i++)
    {
        cin >> x;
        mods[x % k]++;
    }
    for(int i = 0; i < 100; i++)
    {
        if(mods[i] > 1)
            if((i + i) % 2 == 0)
                {
                    count += mods[i] / 2 * 2;
                    mods[i] %= 2;
                }
        if(mods[i] == 0)
        {
            continue;
        }
        for(int j = i; j < 100; j++)
        {
            if(mods[j] == 0)
            {
                continue;
            }
            if(((j + i) % k) == 0)
            {
                if(mods[i] > mods[j])
                {
                    mods[i] -= mods[j];
                    count += mods[j] * 2;
                    mods[j] = 0;
                }
                else
                {
                    mods[j] -= mods[i];
                    count += mods[i] * 2;
                    mods[i] = 0;
                    j = 100;
                }
            }
        }
    }
        cout << count;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    int k;
    int count = 0;
    long long boxes[110000];
    cin >> n >> k;
    for(int i = 0; i < n; i++)
        cin >> boxes[i];
    for(int i = 0; i < n; i++)
    {
        if(boxes[i])
        for(int j = i + 1; j < n; j++)
        {
            if(boxes[j] != 0)
                if((boxes[j] + boxes[i]) % k == 0)
                {
                    boxes[i] = 0;
                    boxes[j] = 0;
                    count += 2;
                    break;
                    }
        }
    }
        cout << count;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    int k;
    bool odd;
    int count = 0;
    long long boxes[220000];
    cin >> n >> k;
    if(k % 2)
        odd = true;
    else
    {
        odd = false;
    }

    for(int i = 0; i < n; i++)
        cin >> boxes[i];
    for(int i = 0; i < n; i++)
    {
        if(boxes[i])
        for(int j = i + 1; j < n; j++)
        {
            if(boxes[j] != 0)
            {
                if(odd)
                {
                    if((boxes[j] % 2 == 0 && boxes[i] % 2 == 0) || (boxes[j] % 2 == 1 && boxes[i] % 2 == 1))
                        continue;
                }
                else
                {
                    if((boxes[j] % 2 != 0 && boxes[i] % 2 == 0) || (boxes[j] % 2 == 0 && boxes[i] % 2 != 0))
                        continue;
                }
                if((boxes[j] + boxes[i]) % k == 0)
                {
                    boxes[i] = 0;
                    boxes[j] = 0;
                    count += 2;
                    break;
                    }
            }

        }
    }
        cout << count;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    int k;
    int count = 0;
    long long boxes[220000];
    cin >> n >> k;
    for(int i = 0; i < n; i++)
        cin >> boxes[i];
    for(int i = 0; i < n; i++)
    {
        if(boxes[i])
        for(int j = i + 1; j < n; j++)
        {
            if(boxes[j] != 0)
                if((boxes[j] + boxes[i]) % k == 0)
                {
                    boxes[i] = 0;
                    boxes[j] = 0;
                    count += 2;
                    break;
                    }
        }
    }
        cout << count;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    int k;
    bool odd;
    int count = 0;
    long long boxes[220000];
    cin >> n >> k;
    if(k % 2)
        odd = true;
    else
    {
        odd = false;
    }

    for(int i = 0; i < n; i++)
        cin >> boxes[i];
    for(int i = 0; i < n; i++)
    {
        if(boxes[i])
        for(int j = i + 1; j < n; j++)
        {
            if(boxes[j] != 0)
            {
                if(odd)
                {
                    if((boxes[j] % 2 == 0 && boxes[i] % 2 == 0) || (boxes[j] % 2 == 0 && boxes[i] % 2 == 0))
                        continue;
                }
                else
                {
                    if(!((boxes[j] % 2 == 0 && boxes[i] % 2 == 0) || (boxes[j] % 2 == 0 && boxes[i] % 2 == 0)))
                        continue;
                }
                                if((boxes[j] + boxes[i]) % k == 0)
                {
                    boxes[i] = 0;
                    boxes[j] = 0;
                    count += 2;
                    break;
                    }
            }

        }
    }
        cout << count;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    int k;
    long long x;
    bool odd;
    int count = 0;
    long long boxes[220000];
    cin >> n >> k;
    if(k % 2)
        odd = true;
    else
    {
        odd = false;
    }

    for(int i = 0; i < n; i++)
    {
        cin >> x;
        boxes[i] = x % k;
    }

    for(int i = 0; i < n; i++)
    {
        if(boxes[i] != -1)
        for(int j = i + 1; j < n; j++)
        {
            if(boxes[j] != -1)
            {
                if((boxes[j] + boxes[i]) % k == 0)
                {
                    boxes[i] = -1;
                    boxes[j] = -1;
                    count += 2;
                    break;
                    }
            }

        }
    }
        cout << count;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    int k;
    long long x;
    int count = 0;
    long long mods[100];
    for (int i = 0; i < 100; i++)
        mods[i] = 0;
    cin >> n >> k;

    for(int i = 0; i < n; i++)
    {
        cin >> x;
        mods[x % k]++;
    }
    for(int i = 0; i < 100; i++)
    {
        if(mods[i] > 1)
            if((i + i) % k == 0)
            {
                count += mods[i] / 2 * 2;
                mods[i] %= 2;
            }
        if(mods[i] == 0)
        {
            continue;
        }
        for(int j = i; j < 100; j++)
        {
            if(mods[j] == 0)
            {
                continue;
            }
            if((((j + i) % k) == 0) && (i != j))
            {
                if(mods[i] > mods[j])
                {
                    mods[i] -= mods[j];
                    count += mods[j] * 2;
                    mods[j] = 0;
                }
                else
                {
                    mods[j] -= mods[i];
                    count += mods[i] * 2;
                    mods[i] = 0;
                    j = 100;
                }
            }
        }
    }
    cout << count;
}


#include <iostream>
#include <vector>

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    m[d % k]++;
  }

  int res = m[0]  - (m[0] & 1);
  for (int i = 1; i <= (k >> 1); i++) {
    const int b = std::min(m[i], m[k - i]);
    int x = (b - (b & 1));
    if (i != k - 1) x <<= 1;
    res += x;
  }

  std::cout << res << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int to_even(int x) {
  return x - (x & 1);
}

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    ++m[d % k];
  }

  int res = to_even(m[0]);
  for (int i = 1; i <= (k >> 1); i++) {
    int b = std::min(m[i], m[k - i]);
    if (i != k - i) b <<= 1;
    else b = to_even(b);
    res += b;
  }

  std::cout << res << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int to_even(int x) {
  return x - (x & 1);
}

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    ++m[d % k];
  }

  int res = to_even(m[0]);
  if (k > 1 && k & 1)
    res += std::min(m[k >> 1], m[(k >> 1) + 1]) << 1;
  else if (k > 1)
    res += to_even(m[k >> 1]);
  for (int i = 1; i < (k >> 1); i++) {
    int b = std::min(m[i], m[k - i]) << 1;
    res += b;
  }

  std::cout << res << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    m[d % k]++;
  }

  int res = m[0]  - (m[0] & 1);
  for (int i = 1; i <= (k >> 1); i++) {
    const int b = std::min(m[i], m[k - i]);
    int x = (b - (b & 1));
    if (i != k - i) x <<= 1;
    res += x;
  }

  std::cout << res << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> d(n);
  for (int i = 0; i < n; i++)
    std::cin >> d[i];

  int res = 0;
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++)
      if ((d[i] + d[j]) % k == 0)
	res++;

  std::cout << (res + 1) / 2 << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int to_even(int x) {
  return x - (x & 1);
}

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    ++m[d % k];
  }

  int res = to_even(m[0]);
  if (k & 1)
    res += std::min(m[k >> 1], m[(k >> 1) + 1]) << 1;
  else
    res += to_even(m[k >> 1]);
  for (int i = 1; i < (k >> 1); i++) {
    int b = std::min(m[i], m[k - i]) << 1;
    res += b;
  }

  std::cout << res << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int to_even(int x) {
  return x - (x & 1);
}

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    ++m[d % k];
  }

  int res = to_even(m[0]);
  for (int i = 1; i <= (k >> 1); i++) {
    int b = std::min(m[i], m[k - i]);
    if (i != k - i) b = to_even(b) << 1;
    res += b;
  }

  std::cout << res << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

inline int to_even(int x) {
  return x - (x & 1);
}

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    ++m[d % k];
  }

  int res = to_even(m[0]);

  if (k > 1 && k & 1)
    res += std::min(m[k >> 1], m[(k >> 1) + 1]) << 1;
  else if (k > 1)
    res += to_even(m[k >> 1]);

  for (int i = 1; i < (k >> 1); i++) {
    int b = std::min(m[i], m[k - i]) << 1;
    res += b;
  }

  std::cout << res << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    m[d % k]++;
  }

  for (auto x : m)
    std::cout << x << " ";
  std::cout << std::endl;

  int res = m[0]  - (m[0] & 1);
  for (int i = 1; i <= (k >> 1); i++) {
    const int b = std::min(m[i], m[k - i]);
    int x = (b - (b & 1));
    if (i != k - 1) x <<= 1;
    res += x;
  }

  std::cout << res << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int to_even(int x) {
  return x - (x & 1);
}

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    ++m[d % k];
  }

  int res = to_even(m[0]);
  if (k > 1 && k & 1)
    res += std::min(m[k >> 1], m[(k >> 1) + 1]) << 1;
  else
    res += to_even(m[k >> 1]);
  for (int i = 1; i < (k >> 1); i++) {
    int b = std::min(m[i], m[k - i]) << 1;
    res += b;
  }

  std::cout << res << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int to_even(int x) {
  return x - (x & 1);
}

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    ++m[d % k];
  }

  for (auto x : m)
    std::cout << x << " ";
  std::cout << std::endl;

  int res = to_even(m[0]);
  for (int i = 1; i <= (k >> 1); i++) {
    int b = to_even(std::min(m[i], m[k - i]));
    if (i != k - i) b <<= 1;
    res += b;
  }

  std::cout << res << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> d(n);
  for (int i = 0; i < n; i++)
    std::cin >> d[i];

  int res = 0;
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++)
      if ((d[i] + d[j]) % k == 0)
	res++;

  std::cout << res / 2 << std::endl;

  return 0;
}


#include <iostream>
#include <vector>

int to_even(int x) {
  return x - (x & 1);
}

int main() {
  int n, k;

  std::cin >> n >> k;

  std::vector<int> m(k);
  for (int i = 0; i < n; i++) {
    int d;
    std::cin >> d;
    ++m[d % k];
  }

  int res = to_even(m[0]);
  for (int i = 1; i <= (k >> 1); i++) {
    int b = to_even(std::min(m[i], m[k - i]));
    if (i != k - i) b <<= 1;
    res += b;
  }

  std::cout << res << std::endl;

  return 0;
}


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

int main()
{
    long long int n,k,c=0,i,j;
    cin>>n>>k;
    vector<long long int>  u,v;
    for(i=0;i<n;i++)
    {
        long long int a;
        cin>>a;
        if(a%2==0)
        {
            u.push_back(a);
        }
        else
        v.push_back(a);
    }
    if(k%2==0)
    {
        for(i=0;i<u.size();i++)
      {
        if(u[i]!=0)
        {
            j=i+1;
            while(j!=u.size())
            {
                if(u[j]==0)
                j++;
                else if((u[i]+u[j])%k==0)
                {
                    u[i]=0;
                    u[j]=0;
                    c++;
                    break;
                }
                else
                j++;
            }
        }
      }
      for(i=0;i<v.size();i++)
      {
        if(v[i]!=0)
        {
            j=i+1;
            while(j!=v.size())
            {
                if(v[j]==0)
                j++;
                else if((v[i]+v[j])%k==0)
                {
                    v[i]=0;
                    v[j]=0;
                    c++;
                    break;
                }
                else
                j++;
            }
        }
      }
    }
    else
    {
        for(i=0;i<u.size();i++)
        {
            for(j=0;j<v.size();j++)
            {
                if((u[i]+v[j])%k==0 && v[j]!=0)
                {
                    v[j]=0;
                    c++;
                    continue;
                }
            }
        }
    }
    cout<<c*2;
}


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

int main()
{
    long long i,c=0,n,k,j;
    cin>>n>>k;
    vector<long long> v;
    for(i=0;i<n;i++)
    {
        long long a;
        cin>>a;
        if(a%k==0)
        c++;
        else
        v.push_back(a%k);
    }
    if(c%2!=0)
    c--;
    sort(v.begin(),v.end());
    for(i=0,j=v.size()-1;i<j;)
    {
        long long x=(v[i]+v[j])%k;
        if(x<0)
            i++;
        else if(x==0)
         {
             c+=2;
             i++;
             j--;
         }
        else
            j--;
    }
    cout<<c;
}


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

int main()
{
    long long i,c=0,n,k,j;
    cin>>n>>k;
    vector<long long> v;
    for(i=0;i<n;i++)
    {
        long long a;
        cin>>a;
        if(a%k==0)
        c++;
        else
        v.push_back(a%k);
    }
    if(c%2!=0)
    c--;
    if(v.size()==0)
    goto flag;
    sort(v.begin(),v.end());
    for(i=0,j=v.size()-1;i<j;)
    {
        long long x=(v[i]+v[j])-k;
        if(x<0)
            i++;
        else if(x==0)
         {
             c+=2;
             i++;
             j--;
         }
        else
            j--;
    }
    flag:
    cout<<c;
}


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

int main()
{
    long long i,c=0,n,k,j;
    cin>>n>>k;
    vector<long long> v;
    for(i=0;i<n;i++)
    {
        long long a;
        cin>>a;
        if(a%k==0)
        c++;
        else
        v.push_back(a%k);
    }
    if(c%2!=0)
    c--;
    sort(v.begin(),v.end());
    for(i=0,j=v.size()-1;i<j;)
    {
        long long x=(v[i]+v[j])-k;
        if(x<0)
            i++;
        else if(x==0)
         {
             c+=2;
             i++;
             j--;
         }
        else
            j--;
    }
    cout<<c;
}


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

int main()
{
    long long i,c=0,n,k,j;
    cin>>n>>k;
    vector<long long> v;
    for(i=0;i<n;i++)
    {
        long long a;
        cin>>a;
        if(a%k==0)
        c++;
        else
        v.push_back(a%k);
    }
    if(c%2!=0)
    c--;
    for(i=0;i<v.size()-1;i++)
    {
        for(j=i+1;j<v.size();i++)
        {
            if((v[i]+v[j])%k==0 && v[i]!=0 && v[j]!=0)
            {
                c+=2;
                v[j]=0;
                break;
            }
        }
    }
    cout<<c;
}


#include <iostream>
using namespace std;

int main()
{
    long long int n,k,i;
    cin>>n>>k;
    long long int d[n];
    for(i=0;i<n;i++)
    {
        cin>>d[i];
    }
    long long int c=0,j;
    for(i=0;i<n;i++)
    {
        if(d[i]!=0)
        {
            j=i+1;
            while(j!=n)
            {
                if((d[i]+d[j])%k==0)
                {
                    d[i]=0;
                    d[j]=0;
                    c++;
                    break;
                }
                j++;
            }
        }
    }
    cout<<c*2;
}


#include <iostream>
using namespace std;

int main()
{
    long long int n,k,i;
    cin>>n>>k;
    long long int d[n];
    for(i=0;i<n;i++)
    {
        cin>>d[i];
    }
    long long int c=0,j;
    for(i=0;i<n;i++)
    {
        if(d[i]!=0)
        {
            j=i+1;
            while(j!=n)
            {
                if(d[j]==0)
                j++;
                else if((d[i]+d[j])%k==0)
                {
                    d[i]=0;
                    d[j]=0;
                    c++;
                    break;
                }
                else
                j++;
            }
        }
    }
    cout<<c*2;
}


#include <bits/stdc++.h>
using namespace std;
long long c[1000];
int main()
{
    long long i,j,k,n,m,x=0,y,z;
    cin>>n>>k;
    for(i=1; i<=n; i++)
    {
        cin>>j;
        ++c[j%k];
    }

    x=c[0]/2;
    if(k%2==0){
        x=x+(c[k/2]/2);
    }
    if(k==1)
    {
        cout<<2*x<<endl;
        return 0;
    }

    for(i=1; i<(k+1)/2; ++i)
    {
        j=k-i;
        y=min(c[i],c[j]);
        x=x+y;
    }

    cout<<2*x<<endl;

}


#include <bits/stdc++.h>

using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	int n, k;
	cin >> n >> k;
	vector<int> cnt(k);
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		++cnt[x % k];
	}
	int ans = cnt[0] / 2;
	if (k % 2 == 0) ans += cnt[k / 2] / 2;
	for (int i = 1; i < (k + 1) / 2; ++i) {
		int j = k - i;
		ans += min(cnt[i], cnt[j]);
	}

	cout << ans * 2 << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long c[1000];
int main()
{
    long long i,j,k,n,m,x=0,y,z;
    cin>>n>>k;
    for(i=1; i<=n; i++)
    {
        cin>>j;
        ++c[j%k];
    }

    x=c[0]/2;
    if(k==2)
    {
        x=x+(c[1]/2);
        cout<<2*x<<endl;
        return 0;
    }
    if(k==1)
    {
        cout<<2*x<<endl;
        return 0;
    }
    for(i=1; i<(k+1)/2; ++i)
    {
        j=k-i;
        y=min(c[i],c[j]);
        x=x+y;
    }

    cout<<2*x<<endl;

}


#include<bits/stdc++.h>

using namespace std;

#define int1 long long

int main()
{
    int1 n,i,j,k,sum;
    cin>>n>>k;
    int a[n],f[k]={0};
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]=a[i]%k;
        f[a[i]]++;
    }
    sum=f[0]/2;

     for(i=1;i<=k/2;i++)
     {
        // cout<<f[i];
         sum=sum+min(f[i],f[k-i]);
     }
     if(k%2==0)
     sum=sum-f[k/2]+f[k/2]/2;
     cout<<2*sum;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define int1 long long

int main()
{
    int1 n,i,j,k,c=0;
    cin>>n>>k;
    int1 a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[n];
    }

    for(i=0;i<n;i++)
    {if(a[i]!=0)
        {for(j=i+1;j<n;j++)
            {
                if(a[j]!=0)
                {if((a[i]+a[j])%k==0)
                {

                    c++;
                    a[i]=0;
                    a[j]=0;
                    j=n;
                }
                }
            }

        }
    }

  i=c+c;
    cout<<i;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define int1 long long

int main()
{
    int1 n,i,j,k,sum;
    cin>>n>>k;
    int a[n],f[k]={0};
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]=a[i]%k;
        f[a[i]]++;
    }
    sum=f[i]/2;
    if(k%2==0)
     for(i=1;i<=k/2;i++)
     {
         sum=sum+min(f[i],f[k-i]);
     }
     cout<<sum;
    return 0;
}
#inc


#include<bits/stdc++.h>

using namespace std;

#define int1 long long

int main()
{
    int1 n,i,j,ksum;
    cin>>n>>k;
    int a[n],f[k]={0};
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]=a[i]%k;
        f[a[i]]++;
    }
    sum=f[0]/2;
    if(k%2==0)
     for(i=1;i<=k/2;i++)
     {
         sum=sum+min(f[i],f[k-i]);
     }
     cout<<sum;
    return 0;
}
#inc


import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
//ArrayList<Integer> list = new ArrayList<Integer>();
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
 public static void main(String[] args) throws IOException {
	 Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 ArrayList<Integer> a = new ArrayList<Integer>();
	 for(int i=0 ; i<n ; i++) {
		 a.add(sc.nextInt());
	 }
	 Collections.sort(a);
	 long sum=0;
	 int l=a.size()-1;
	 for(int i=l ;i>0 ; i--){
		 sum=sum+a.get(i);
	 }
	 if((a.get(0)+sum)%2==0) {
		 sum=a.get(0)+sum;
		 System.out.println(sum);
	 }
	 else {
		 System.out.println(sum);
	 }

 }
 static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}

		public long[] nextLongArr(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextLong();
			return arr;
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}


import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
//ArrayList<Integer> list = new ArrayList<Integer>();
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
 public static void main(String[] args) throws IOException {
	 Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 ArrayList<Long> a = new ArrayList<Long>();
	 for(int i=0 ; i<n ; i++) {
		 a.add(sc.nextLong());
	 }
	 Collections.sort(a);
	 long sum=0;
	 int l=a.size()-1;
	 for(int i=l ;i>0 ; i--){
		 sum=sum+a.get(i);
	 }
	 if((a.get(0)+sum)%2==0) {
		 sum=a.get(0)+sum;
		 System.out.println(sum);
	 }
	 else if(sum%2!=0) {
		 int c=0;
		 while(sum%2!=0 ) {
			 sum=0;
			 l--;

		 for(int i=l ;i>c ; i--){
			 sum=sum+a.get(i);
		 }
		 c++;
		 }
		 System.out.println(sum);
	 }
	 else {
		 System.out.println(sum);
	 }

 }
 static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}

		public long[] nextLongArr(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextLong();
			return arr;
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}


import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
//ArrayList<Integer> list = new ArrayList<Integer>();
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
 public static void main(String[] args) throws IOException {
	 Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 ArrayList<Long> a = new ArrayList<Long>();
	 for(int i=0 ; i<n ; i++) {
		 a.add(sc.nextLong());
	 }
	 Collections.sort(a);
	 long sum=0;
	 int l=a.size()-1;
	 for(int i=l ;i>0 ; i--){
		 sum=sum+a.get(i);
	 }
	 if((a.get(0)+sum)%2==0) {
		 sum=a.get(0)+sum;
		 System.out.println(sum);
	 }
	 else {
		 System.out.println(sum);
	 }

 }
 static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}

		public long[] nextLongArr(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextLong();
			return arr;
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}


import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
//ArrayList<Integer> list = new ArrayList<Integer>();
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
 public static void main(String[] args) throws IOException {
	 Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 ArrayList<Long> a = new ArrayList<Long>();
	 for(int i=0 ; i<n ; i++) {
		 a.add(sc.nextLong());
	 }
	 Collections.sort(a);
	 long sum=0;
	 int l=a.size()-1;
	 for(int i=l ;i>0 ; i--){
		 sum=sum+a.get(i);
	 }
	 if((a.get(0)+sum)%2==0) {
		 sum=a.get(0)+sum;
		 System.out.println(sum);
	 }
	 else if(sum%2!=0) {
		 while(sum%2!=0) {
		 l--;
		 for(int i=l ;i>0 ; i--){
			 sum=sum+a.get(i);
		 }
		 }
	 }
	 else {
		 System.out.println(sum);
	 }

 }
 static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}

		public long[] nextLongArr(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextLong();
			return arr;
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}


import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
//ArrayList<Integer> list = new ArrayList<Integer>();
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
 public static void main(String[] args) throws IOException {
	 Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 ArrayList<Long> a = new ArrayList<Long>();
	 for(int i=0 ; i<n ; i++) {
		 a.add(sc.nextLong());
	 }
	 Collections.sort(a);
	 long sum=0;
	 int l=a.size()-1;
	 for(int i=l ;i>0 ; i--){
		 sum=sum+a.get(i);
	 }
	 if((a.get(0)+sum)%2==0) {
		 sum=a.get(0)+sum;
		 System.out.println(sum);
	 }
	 else if(sum%2!=0) {
		 sum=0;
		 while(sum%2!=0) {
		 l--;
		 for(int i=l ;i>0 ; i--){
			 sum=sum+a.get(i);
		 }
		 }
	 }
	 else {
		 System.out.println(sum);
	 }

 }
 static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}

		public long[] nextLongArr(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextLong();
			return arr;
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}


import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
//ArrayList<Integer> list = new ArrayList<Integer>();
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
 public static void main(String[] args) throws IOException {
	 Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 ArrayList<Long> a = new ArrayList<Long>();
	 for(int i=0 ; i<n ; i++) {
		 a.add(sc.nextLong());
	 }
	 Collections.sort(a);
	 long sum=0;
	 int l=a.size()-1;
	 for(int i=l ;i>0 ; i--){
		 sum=sum+a.get(i);
	 }
	 if((a.get(0)+sum)%2==0) {
		 sum=a.get(0)+sum;
		 System.out.println(sum);
	 }
	 else if(sum%2!=0) {
		 for(int i=l ;i>1 ; i--){
			 sum=sum+a.get(i);
		 }

	 }
	 else {
		 System.out.println(sum);
	 }

 }
 static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}

		public long[] nextLongArr(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextLong();
			return arr;
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}


import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
//ArrayList<Integer> list = new ArrayList<Integer>();
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
 public static void main(String[] args) throws IOException {
	 Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 ArrayList<Long> a = new ArrayList<Long>();
	 for(int i=0 ; i<n ; i++) {
		 a.add(sc.nextLong());
	 }
	 Collections.sort(a);
	 long sum=0;
	 int l=a.size()-1;
	 for(int i=l ;i>0 ; i--){
		 sum=sum+a.get(i);
	 }
	 if((a.get(0)+sum)%2==0) {
		 sum=a.get(0)+sum;
		 System.out.println(sum);
	 }
	 else if(sum%2!=0) {

		 while(sum%2!=0 ) {
			 sum=0;
			 l--;
		 for(int i=l ;i>0 ; i--){
			 sum=sum+a.get(i);
		 }
		 }
		 System.out.println(sum);
	 }
	 else {
		 System.out.println(sum);
	 }

 }
 static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}

		public long[] nextLongArr(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextLong();
			return arr;
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}


import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
//ArrayList<Integer> list = new ArrayList<Integer>();
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
 public static void main(String[] args) throws IOException {
	 Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 ArrayList<Long> a = new ArrayList<Long>();
	 for(int i=0 ; i<n ; i++) {
		 a.add(sc.nextLong());
	 }
	 Collections.sort(a);
	 long sum=0;
	 int l=a.size()-1;
	 for(int i=l ;i>0 ; i--){
		 sum=sum+a.get(i);
	 }
	 if((a.get(0)+sum)%2==0) {
		 sum=a.get(0)+sum;
		 System.out.println(sum);
	 }
	 else if(sum%2!=0) {
		 sum=0;
		 while(sum%2!=0 && sum!=0) {
		 l--;
		 for(int i=l ;i>0 ; i--){
			 sum=sum+a.get(i);
		 }
		 }
		 System.out.println(sum);
	 }
	 else {
		 System.out.println(sum);
	 }

 }
 static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}

		public long[] nextLongArr(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextLong();
			return arr;
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		int l=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		while(r%2!=0&&neven!=0&&nodd>=2) {
		if(odd[0]<even[0]) {
			r=r-(odd[l]);
			l++;}
		else {
			r=-r-even[o];
			o++;
		}
		}
		while(r%2!=0) {
			r-=y[0];

		}
	System.out.println(r);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		int p=0;
		int l=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		while(r%2!=0&&neven!=0&&nodd>0) {
		if(odd[l]<even[o]) {
			r=r-(odd[l]);
			l++;}
		else {
			r=-r-even[o];
			o++;
		}
		}
		while(r%2!=0) {
			r-=y[p];
			p++;

		}
	System.out.println(r);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int g=0;
		long r;
		int j=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2!=0)
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2!=0) {
					odd[g]=y[k];
					g++;
				}
			}
		int l=0;
		Arrays.sort(odd);
		while(r%2!=0&&nodd>0&&r>0) {
			r=r-(odd[l]);
			l++;
		}

	if(nodd==0&&r%2==0)
		System.out.println(r);
	else if(r%2==0)
		System.out.println(r);
	else
		System.out.println(0);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		int p=0;
		int l=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		while(r%2!=0&&nodd>0&&r>0) {
			r=r-(odd[l]);
			l++;
		}
		while(r%2!=0&&r>0) {
			r-=y[p];
			p++;
		}
	if(r>0)
	System.out.println(r);
	else
		System.out.println(0);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2!=0) {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		int p=0;
		int l=0;
		Arrays.sort(odd);
		while(r%2!=0&&nodd>0&&r>0) {
			r=r-(odd[l]);
			l++;
		}

	if(nodd==0&&r%2==0)
		System.out.println(r);
	else if(r%2==0)
		System.out.println(r);
	else
		System.out.println(0);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		int p=0;
		int l=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		while(r%2!=0&&neven!=0&&nodd>0&&r>0) {
		if(odd[l]<even[o]) {
			r=r-(odd[l]);
			l++;}
		else {
			r=-r-even[o];
			o++;
		}
		}
		while(r%2!=0&&r>0) {
			r-=y[p];
			p++;
		}
	if(r>0)
	System.out.println(r);
	else
		System.out.println(0);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		if(r%2!=0&&neven!=0&&nodd>=2) {
		if(even[0]<odd[0])
			r-=even[0];
		if(odd[0]<even[0])
			r=r-(odd[0]+odd[1]);}
		else {
			while(r%2!=0) {
				r-=y[o];
				o++;
			}
		}
	System.out.println(r);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}//
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		long r;
		int j=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
		}
		r=sum(y);
		Arrays.sort(y);
		while (true) {
			if(r%2==0)
				break;
			else {
				r-=y[j];
				j++;
			}
		}
	System.out.println(r);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		int p=0;
		int l=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		while(r%2!=0&&neven!=0&&nodd>0) {
		if(odd[0]<even[0]) {
			r=r-(odd[l]);
			l++;}
		else {
			r=-r-even[o];
			o++;
		}
		}
		while(r%2!=0) {
			r-=y[p];
			p++;

		}
	System.out.println(r);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		while(r%2!=0&&neven!=0&&nodd>=2) {
		if(odd[0]<even[0])
			r=r-(odd[0]);
		else {
			r=-r-even[o];
			o++;
		}
		}
		while(r%2!=0) {
			r-=y[0];

		}
	System.out.println(r);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		int p=0;
		int l=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		while(r%2!=0&&nodd>0&&r>0) {
			r=r-(odd[l]);
			l++;
		}

	if(nodd==0&&r%2==0)
		System.out.println(r);
	else if(r%2==0)
		System.out.println(r);
	else
		System.out.println(0);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		long r;
		int j=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
		}
		r=sum(y);
		Arrays.sort(y);
		while (true) {
			if(r%2==0)
				break;
			else {
				r-=y[j];
				j++;
			}
		}
	System.out.println(r);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		int p=0;
		int l=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		while(r%2!=0&&neven!=0&&nodd>0) {
		if(odd[0]<even[0]) {
			r=r-(odd[l]);
			l++;}
	/*	else {
			r=-r-even[o];
			o++;
		}*/
		}
		while(r%2!=0) {
			r-=y[p];
			p++;

		}
	System.out.println(r);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		int p=0;
		int l=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		while(r%2!=0&&nodd>0&&r>0) {
			r=r-(odd[l]);
			l++;
		}

	if(nodd==0&r%2==0)
	System.out.println(r);
	else
		System.out.println(0);
	}
}


import java.util.*;
public class shark {
public static long sum(long[]x) {
	long s = 0;
	for(int i=0;i<x.length;i++) {
		s+=x[i];
	}
return s;
}
	public static void main (String args[]) {
		Scanner a=new Scanner(System.in);
		int x=a.nextInt();
		long[]y=new long [x];
		int f=0; int g=0;
		long r;
		int j=0;
		int neven=0;
		int nodd=0;
		for(int i=0;i<x;i++) {
			y[i]=a.nextLong();
			if(y[i]%2==0)
				neven++;
			else
				nodd++;
		}
		r=sum(y);
		Arrays.sort(y);
		long [] even=new long[neven];
		long [] odd=new long[nodd];
		for(int k=0;k<x;k++) {
			if(y[k]%2==0) {
				even[f]=y[k];
				f++;}
				else {
					odd[g]=y[k];
					g++;
				}
			}
		int o=0;
		int l=0;
		Arrays.sort(even);
		Arrays.sort(odd);
		while(r%2!=0&&neven!=0&&nodd>0) {
		if(odd[0]<even[0]) {
			r=r-(odd[l]);
			l++;}
		else {
			r=-r-even[o];
			o++;
		}
		}
		while(r%2!=0) {
			r-=y[0];

		}
	System.out.println(r);
	}
}


import java.util.*;
public class WetSharkandOddandEven {
public static void main(String[]args) {
	Scanner a=new Scanner (System.in);
	int x=a.nextInt();
	long sum=0;
	long[]y=new long [x];
	long b = Integer.MAX_VALUE;
	for(int i=0;i<x;i++) {
		y[i]=a.nextLong();
		if(y[i]<b&&y[i]%2==1)
			b= y[i];
		sum+=y[i];
	}
if(sum%2==0)
	System.out.println(sum);
else
	System.out.println((sum-b));
}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class coc {
	public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x=Integer.parseInt(st.nextToken());
		StringTokenizer d=new StringTokenizer(br.readLine());
		int c= Integer.parseInt(d.nextToken());
		int sum=c;
		int[] e= new int[5];
		int u=0;
		int h=e.length-1;
		for(int i=1;i<=x;i++) {

			int j=Integer.parseInt(d.nextToken());
			e[u++]=j;
			sum=sum+j;
			if(i==x) {
				if(!(sum%2==0)) {
					while(!(sum%2==0)) {
						sum=sum-e[h--];
					}
				}
			}
		}
    	System.out.print(sum);

	}

	}


public class coc {
	public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x=Integer.parseInt(st.nextToken());
		StringTokenizer d=new StringTokenizer(br.readLine());
		long sum=0;
		int[] e= new int[x];
		int u=0;
		double r=Double.POSITIVE_INFINITY;
		for(int i=1;i<=x;i++) {
			int j=Integer.parseInt(d.nextToken());
			sum=sum+j;
			if(j%2!=0 && j<r )
				r=j;
			if(i==x) {
				if(!(sum%2==0)) {
						sum=sum-r;
				}
			}
		}
    	System.out.println(sum);

	}

	}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class coc {
	public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x=Integer.parseInt(st.nextToken());
		StringTokenizer d=new StringTokenizer(br.readLine());
		long sum=0;
		int[] e= new int[x];
		int u=0;
		double r=Double.POSITIVE_INFINITY;
		for(int i=1;i<=x;i++) {
			int j=Integer.parseInt(d.nextToken());
			sum=sum+j;
			if(j%2!=0 && j<r )
				r=j;
			if(i==x) {
				if(!(sum%2==0)) {
						sum=(long) (sum-r);
				}
			}
		}
    	System.out.println(sum);

	}

	}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class coc {
	public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x=Integer.parseInt(st.nextToken());
		StringTokenizer d=new StringTokenizer(br.readLine());
		long sum=0;
		int[] e= new int[x];
		int u=0;
		double r=Double.POSITIVE_INFINITY;
		for(int i=1;i<=x;i++) {
			int j=Integer.parseInt(d.nextToken());
			sum=sum+j;
			if(j%2!=0 && j<r )
				r=j;
			if(i==x) {
				if(!(sum%2==0)) {
						sum=sum-j;
				}
			}
		}
    	System.out.println(sum);

	}

	}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class coc {
	public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x=Integer.parseInt(st.nextToken());
		StringTokenizer d=new StringTokenizer(br.readLine());
		long sum=0;
		int[] e= new int[5];
		int u=0;
		int h=e.length-1;
		for(int i=1;i<=x;i++) {

			int j=Integer.parseInt(d.nextToken());
			e[u++]=j;
			sum=sum+j;
			if(i==x) {
				if(!(sum%2==0)) {
					while(!(sum%2==0)) {
						sum=sum-e[h--];					}
				}
			}
		}
    	System.out.println(sum);

	}

	}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class coc {
	public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x=Integer.parseInt(st.nextToken());
		StringTokenizer d=new StringTokenizer(br.readLine());
		long sum=0;
		int[] e= new int[x];
		int u=0;
		int h=e.length-1;
		for(int i=1;i<=x;i++) {

			int j=Integer.parseInt(d.nextToken());
			e[u++]=j;
			sum=sum+j;
			if(i==x) {
				if(!(sum%2==0)) {
					while(!(sum%2==0)) {
						sum=sum-e[h--];					}
				}
			}
		}
    	System.out.println(sum);

	}

	}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class coc {
	public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x=Integer.parseInt(st.nextToken());
		StringTokenizer d=new StringTokenizer(br.readLine());
		long sum=0;
		int[] e= new int[x];
		int u=0;
		int h=-1;
		for(int i=1;i<=x;i++) {

			int j=Integer.parseInt(d.nextToken());
			sum=sum+j;
			if(j%2!=0 && j<h )
				h=j;
			if(i==x) {
				if(!(sum%2==0)) {
						sum=sum-h;
				}
			}
		}
    	System.out.println(sum);

	}

	}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class coc {
	public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x=Integer.parseInt(st.nextToken());
		StringTokenizer d=new StringTokenizer(br.readLine());
		int c= Integer.parseInt(d.nextToken());
		int sum=c;
		int[] e= new int[5];
		int u=0;
		int h=e.length-1;
		for(int i=1;i<x;i++) {

			int j=Integer.parseInt(d.nextToken());
			e[u++]=j;
			sum=sum+j;
			if(i==x) {
				if(!(sum%2==0)) {
					while(!(sum%2==0)) {
						sum=sum-e[h--];
					}
				}
			}
		}
    	System.out.print(sum);

	}

	}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class coc {
	public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x=Integer.parseInt(st.nextToken());
		StringTokenizer d=new StringTokenizer(br.readLine());
		int sum=0;
		int[] e= new int[5];
		int u=0;
		int h=e.length-1;
		for(int i=1;i<=x;i++) {

			int j=Integer.parseInt(d.nextToken());
			e[u++]=j;
			sum=sum+j;
			if(i==x) {
				if(!(sum%2==0)) {
					while(!(sum%2==0)) {
						sum=sum-e[h--];
					}
				}
			}
		}
    	System.out.print(sum);

	}

	}


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = 0, num = 0;
        long sum = 0;
        List<Integer> arr = new ArrayList<>();
        n = input.nextInt();
        for(int i = 0; i < n; ++i){
            num = input.nextInt();
            arr.add(num);
            sum += num;
        }
        while(true){
            if(sum % 2 == 0) {
                System.out.println(sum);
                break;
            }
            else{
                int min = Integer.MAX_VALUE;
                sum -= Collections.max(arr);
            }
        }
    }
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = 0, num = 0;
        long sum = 0;
        List<Integer> arr = new ArrayList<>();
        n = input.nextInt();
        for(int i = 0; i < n; ++i){
            num = input.nextInt();
            arr.add(num);
            sum += num;
        }
        while(true){
            if(sum % 2 == 0) {
                System.out.println(sum);
                break;
            }
            else{
                sum -= Collections.min(arr);
            }
        }
    }
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = 0, num = 0;
        long sum = 0;
        List<Integer> arr = new ArrayList<>();
        n = input.nextInt();
        for(int i = 0; i < n; ++i){
            num = input.nextInt();
            arr.add(num);
            sum += num;
        }
        while(true){
            System.out.println(sum);
            if(sum % 2 == 0) {
                System.out.println(sum);
                break;
            }
            else{
                int min = Integer.MAX_VALUE;
                sum -= Collections.max(arr);
            }
        }
    }
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = 0, num = 0;
        long sum = 0;
        List<Integer> arr = new ArrayList<>();
        n = input.nextInt();
        for(int i = 0; i < n; ++i){
            num = input.nextInt();
            arr.add(num);
            sum += num;
        }
        while(true){
            if(sum % 2 == 0) {
                System.out.println(sum);
                break;
            }
            else{
                sum -= Collections.min(arr);
                arr.remove(Collections.min(arr));
            }
        }
    }
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = 0, num = 0;
        long sum = 0;
        List<Integer> arr = new ArrayList<>();
        List<Integer> arr2 = new ArrayList<>();
        n = input.nextInt();
        for(int i = 0; i < n; ++i){
            num = input.nextInt();
            arr.add(num);
            sum += num;
            if(num % 2 != 0)  arr2.add(num);
        }
        while(true){
            if(sum % 2 == 0) {
                System.out.println(sum);
                break;
            }
            else{
                sum -= Collections.min(arr2);
                arr.remove(Collections.min(arr2));
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Random;
import java.util.Set;

public class apples {

	public static void main(String args[]) throws IOException{
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		long lowestOdd=9999999999999l;
		long sum = 0;
		int x = Integer.parseInt(bf.readLine());
		String[] line = bf.readLine().split(" ");
		for(int i=0; i<x; i++){
			long b = Long.parseLong(line[i]);
			sum+=b;
			if(b<lowestOdd && b%2==1)
				lowestOdd=b;
		}
		//System.out.println(lowestOdd);
		//System.out.println(sum);
		if(sum%2==0)
			System.out.println(sum);
		else
			System.out.println(sum-lowestOdd);
	}

}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Random;
import java.util.Set;

public class apples {

	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		long lowestOdd=9999999999999l;
		long sum = 0;
		int x = sc.nextInt();

		for(int i=0; i<x; i++){
			long b = sc.nextLong();
			sum+=b;
			if(b<lowestOdd)
				lowestOdd=b;
		}
		//System.out.println(lowestOdd);
		//System.out.println(sum);
		if(sum%2==0)
			System.out.println(sum);
		else
			System.out.println(sum-lowestOdd);
	}

}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Random;
import java.util.Set;

public class apples {

	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		long lowestOdd=9999999999999l;
		long sum = 0;
		int x = sc.nextInt();

		for(int i=0; i<x; i++){
			long b = sc.nextLong();
			sum+=b;
			if(b<lowestOdd && b%2==1)
				lowestOdd=b;
		}
		//System.out.println(lowestOdd);
		//System.out.println(sum);
		if(sum%2==0)
			System.out.println(sum);
		else
			System.out.println(sum-lowestOdd);
	}

}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Random;
import java.util.Set;

public class apples {

	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		long lowestOdd=9999999999999l;
		long sum = 0;
		int x = sc.nextInt();
		sc.nextLine();
		for(int i=0; i<x; i++){
			long b = sc.nextLong();
			sum+=b;
			if(b<lowestOdd)
				lowestOdd=b;
		}
		//System.out.println(lowestOdd);
		//System.out.println(sum);
		if(sum%2==0)
			System.out.println(sum);
		else
			System.out.println(sum-lowestOdd);
	}

}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Random;
import java.util.Set;

public class apples {

	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int lowestOdd=99999999;
		long sum = 0;
		int x = sc.nextInt();
		for(int i=0; i<x; i++){
			int b = sc.nextInt();
			sum+=b;
			if(b<lowestOdd)
				lowestOdd=b;
		}
		if(sum%2==0)
			System.out.println(sum);
		else
			System.out.println(sum-lowestOdd);
	}

}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Random;
import java.util.Set;

public class apples {

	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		long lowestOdd=999999999;
		long sum = 0;
		int x = sc.nextInt();
		sc.nextLine();
		for(int i=0; i<x; i++){
			long b = sc.nextLong();
			sum+=b;
			if(b<lowestOdd)
				lowestOdd=b;
		}
		//System.out.println(lowestOdd);
		//System.out.println(sum);
		if(sum%2==0)
			System.out.println(sum);
		else
			System.out.println(sum-lowestOdd);
	}

}


import java.math.BigInteger;
import java.util.Scanner;

public class A621WetShark {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		String[] a = new String[n];
		int t = 0;
		while (n-- > 0) {
			a[t] = s.next();
			t++;

		}
		BigInteger bigSum = new BigInteger("0");
		for (int i = 0; i < a.length; i++) {
			BigInteger b = new BigInteger(a[i]);

			bigSum = bigSum.add(b);

		}
		for (int i = a.length - 1; i >= 0; i--) {
			if (bigSum.mod(new BigInteger("2")).equals(BigInteger.ZERO)) {
				System.out.println(bigSum);
				return;
			} else {
				BigInteger b = new BigInteger(a[i]);
				bigSum = bigSum.subtract(b);
			}

		}
		System.out.println(0);
	}
}


import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class A621WetShark {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int sum=0;
		long min=1000000000;
	    while(n-->0)
	    {int a=s.nextInt();
	     if(a%2==1 && a<min)
	     {
	    	 min=a;
	     }
	    sum=sum+a;
	    }
        if(sum%2==0)
        {
        	System.out.println(sum);
        }
        else
        {
        	System.out.println(sum-min);
        }
	}
}


import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class A621WetShark {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		int t = 0;
		while (n-- > 0) {
			a[t] = s.nextInt();
			t++;

		}
		Arrays.sort(a);
		BigInteger bigSum = new BigInteger("0");
		for (int i = 0; i < a.length; i++) {
			String str = "" + a[i];
			BigInteger b = new BigInteger(str);

			bigSum = bigSum.add(b);

		}
		for (int i = a.length - 1; i >= 0; i--) {
			if (bigSum.mod(new BigInteger("2")).equals(BigInteger.ZERO)) {
				System.out.println(bigSum);
				return;
			} else {
				String str = "" + a[i];
				BigInteger b = new BigInteger(str);
				bigSum = bigSum.subtract(b);
			}

		}
	}
}


import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class A621WetShark {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		int t = 0;
		while (n-- > 0) {
			a[t] = s.nextInt();
			t++;

		}
		Arrays.sort(a);
		BigInteger bigSum = new BigInteger("0");
		for (int i = 0; i < a.length; i++) {
			String str = "" + a[i];
			BigInteger b = new BigInteger(str);

			bigSum = bigSum.add(b);

		}
		for (int i = 0; i <a.length ; i++)
		    {
			if (bigSum.mod(new BigInteger("2")).equals(BigInteger.ZERO)) {
				System.out.println(bigSum);
				return;
			} else {
				String str = "" + a[i];
				BigInteger b = new BigInteger(str);
				bigSum = bigSum.subtract(b);
			}

		}
		System.out.println(0);
	}
}


import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class A621WetShark {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		long sum=0;
		long min=1000000000;
	    while(n-->0)
	    {int a=s.nextInt();
	     if(a%2==1 && a<min)
	     {
	    	 min=a;
	     }
	    sum=sum+a;
	    }
        if(sum%2==0)
        {
        	System.out.println(sum);
        }
        else
        {
        	System.out.println(sum-min);
        }
	}
}


import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class A621WetShark {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		int t = 0;
		BigInteger bigSum = new BigInteger("0");
		while (n-- > 0) {
			a[t] = s.nextInt();
			BigInteger b = new BigInteger("" + a[t]);
			bigSum = bigSum.add(b);
			t++;
		}
		Arrays.sort(a);
		for (int i = 0; i < a.length; i++) {
			BigInteger b2 = bigSum;
			for (int j = 0; j < a.length + 1; j++) {

				if (b2.mod(new BigInteger("2")).equals(BigInteger.ZERO)) {
					System.out.println(b2);
					return;
				} else {
					BigInteger b = new BigInteger("" + a[j]);
					b2 = bigSum.subtract(b);
				}
			}
			BigInteger b3 = new BigInteger("" + a[i]);
			bigSum = bigSum.subtract(b3);
		}

	}
}


import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class A621WetShark {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		int t = 0;
		while (n-- > 0) {
			a[t] = s.nextInt();
			t++;
		}
		Arrays.sort(a);
		BigInteger bigSum = new BigInteger("0");
		for (int i = 0; i < a.length; i++) {
			BigInteger b = new BigInteger("" + a[i]);
			bigSum = bigSum.add(b);

		}
		for (int i = 0; i < a.length; i++) {
			BigInteger b2 = bigSum;
			for (int j = 0; j < a.length + 1; j++) {

				if (b2.mod(new BigInteger("2")).equals(BigInteger.ZERO)) {
					System.out.println(b2);
					return;
				} else {
					BigInteger b = new BigInteger("" + a[j]);
					b2 = bigSum.subtract(b);
				}
			}
			BigInteger b3 = new BigInteger("" + a[i]);
			bigSum = bigSum.subtract(b3);
		}

	}
}


import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class A621WetShark {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		int t = 0;
		while (n-- > 0) {
			a[t] = s.nextInt();
			t++;

		}
		Arrays.sort(a);
		BigInteger bigSum = new BigInteger("0");
		for (int i = 0; i < a.length; i++)
		{
			String str = "" + a[i];
			BigInteger b = new BigInteger(str);
          	bigSum = bigSum.add(b);

		}
		    for (int i = 0; i <a.length ; i++)
		    {    BigInteger b2 =bigSum;
			    for (int j = 0; j < a.length+1; j++)
			    {

			        if (b2.mod(new BigInteger("2")).equals(BigInteger.ZERO))
			       {
				    System.out.println(b2);
				    return;
			       }
			       else
			       {

				   String str = "" + a[j];
				   BigInteger b = new BigInteger(str);
				   b2 = bigSum.subtract(b);
			    }
			  }
			        String str = "" + a[i];
				   BigInteger b3 = new BigInteger(str);
			    bigSum=bigSum.subtract(b3);
		}
		System.out.println(0);
	}
}


import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class A621WetShark {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		int t = 0;
		while (n-- > 0) {
			a[t] = s.nextInt();
			t++;

		}
		Arrays.sort(a);
		BigInteger bigSum = new BigInteger("0");
		for (int i = 0; i < a.length; i++)
		{
			String str = "" + a[i];
			BigInteger b = new BigInteger(str);
          	bigSum = bigSum.add(b);

		}
		    for (int i = 0; i <a.length ; i++)
		    {    BigInteger b2 =bigSum;
			    for (int j = 0; j < a.length; j++)
			    {

			        if (b2.mod(new BigInteger("2")).equals(BigInteger.ZERO))
			       {
				    System.out.println(b2);
				    return;
			       }
			       else
			       {
				   String str = "" + a[j];
				   BigInteger b = new BigInteger(str);
				   b2 = bigSum.subtract(b);
			    }
			  }
			        String str = "" + a[i];
				   BigInteger b3 = new BigInteger(str);
			    bigSum=bigSum.subtract(b3);
		}
		System.out.println(0);
	}
}


import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class A621WetShark {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		int t = 0;
		while (n-- > 0) {
			a[t] = s.nextInt();
			t++;

		}
		Arrays.sort(a);
		BigInteger bigSum = new BigInteger("0");
		for (int i = 0; i < a.length; i++) {
			String str = "" + a[i];
			BigInteger b = new BigInteger(str);

			bigSum = bigSum.add(b);

		}
		for (int i = a.length - 1; i >= 0; i--) {
			if (bigSum.mod(new BigInteger("2")).equals(BigInteger.ZERO)) {
				System.out.println(bigSum);
				return;
			} else {
				String str = "" + a[i];
				BigInteger b = new BigInteger(str);
				bigSum = bigSum.subtract(b);
			}

		}
		System.out.println(0);
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long arr[] = new long[n];
        for (int i = 0; i < n; i++)
            arr[i] = in.nextLong();
        long sum = 0;
        for(long x : arr)
            sum += x;
        if(sum%2 == 0) System.out.println(sum);
        else {
            Arrays.sort(arr);
            for (int i = n-1; i > 0; i++) {
                if(arr[i]%2 == 1) {
                    sum -= arr[i];
                    break;
                }
            }
            if(sum%2 == 0) System.out.println(sum);
            else System.out.println(0);
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long arr[] = new long[n];
        for (int i = 0; i < n; i++)
            arr[i] = in.nextLong();
        long sum = 0;
        for(long x : arr)
            sum += x;
        if(sum%2 == 0) System.out.println(sum);
        else {
            Arrays.sort(arr);
            for (int i = n-1; i > 0; i--) {
                if(arr[i]%2 == 1) {
                    sum -= arr[i];
                    break;
                }
            }
            if(sum%2 == 0) System.out.println(sum);
            else System.out.println(0);
        }
    }
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        ArrayList<Long> arr = new ArrayList<>();
        int n = in.nextInt();
        for (int i = 0; i < n; i++)
            arr.add(in.nextLong());
        long sum = 0;
        for(long x : arr)
            sum += x;
        if(sum%2 == 0) System.out.println(sum);
        else {
            Collections.sort(arr);
            for (int i = n-1; i > 0; i++) {
                if(arr.get(i)%2 == 1) {
                    sum -= arr.get(i);
                    break;
                }
            }
            if(sum%2 == 0) System.out.println(sum);
            else System.out.println(0);
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long arr[] = new long[n];
        for (int i = 0; i < n; i++)
            arr[i] = in.nextLong();
        long sum = 0;
        for(long x : arr)
            sum += x;
        if(sum%2 == 0) System.out.println(sum);
        else {
            Arrays.sort(arr);
            for (int i = 0; i < n; i++) {
                if(arr[i]%2 == 1) {
                    sum -= arr[i];
                    break;
                }
            }
            if(sum%2 == 0) System.out.println(sum);
            else System.out.println(0);
        }
    }
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        ArrayList<Integer> arr = new ArrayList<>();
        int n = in.nextInt();
        for (int i = 0; i < n; i++)
            arr.add(in.nextInt());
        int sum = 0;
        for(int x : arr)
            sum += x;
        if(sum%2 == 0) System.out.println(sum);
        else {
            Collections.sort(arr);
            for (int i = n-1; i > 0; i++) {
                if(arr.get(i)%2 == 1) {
                    sum -= arr.get(i);
                    break;
                }
            }
            System.out.println(sum);
        }
    }
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        ArrayList<Long> arr = new ArrayList<>();
        int n = in.nextInt();
        for (int i = 0; i < n; i++)
            arr.add(in.nextLong());
        long sum = 0;
        for(long x : arr)
            sum += x;
        if(sum%2 == 0) System.out.println(sum);
        else {
            Collections.sort(arr);
            for (int i = n-1; i > 0; i++) {
                if(arr.get(i)%2 == 1) {
                    sum -= arr.get(i);
                    break;
                }
            }
            System.out.println(sum);
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class WSAOAE {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int [] array = new int[n];
		for(int i = 0; i < n; i++){
		array[i] = sc.nextInt();
		}
		//Ordenar el array de forma creciente
		Arrays.sort(array); //import Arrays.
		//Encuentra el impar menor.
		int imp = 0;
		for(int i = 0; i < n; i++){
		if(array[i] % 2 == 1){
			imp = imp + array[i];
			break;
		}
		}
	//	System.out.println(imp + " imp");
		//Ordenar el array de forma decreciente
	//	int [] arrayDec = new int[n];
	//	int i = (n-1);
	//	int j = 0;
	//	for(i = i, j = j; i >= 0 && j < n; i--, j++){
	//		arrayDec[j] = array[i];
	//		System.out.println(arrayDec[j] + "ar");
	//	}
		//Sumar todo.
		long suma = 0;
		for (int k = 0; k < array.length; k++) {
			suma += array[k];
	//		System.out.println(suma + "s");
			}
		if(suma % 2 == 0){
		System.out.println(suma);
		}
		else {
		suma = suma - imp;
		System.out.println(suma);
		}

	}

}


import java.util.Arrays;
import java.util.Scanner;

public class WSAOAE {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int [] array = new int[n];
		for(int i = 0; i < n; i++){
		array[i] = sc.nextInt();
		}
		long suma = 0;
		for (int k = 0; k < array.length; k++) {
			suma += array[k];
			}
		if(suma % 2 == 0){
		System.out.println(suma);
		}
		else {
		Arrays.sort(array);
		int imp = 0;
		for(int a = 0; a < n; a++){
		if(array[a] % 2 == 1){
			imp = imp + array[a];
			break;
		}
		}
		suma = suma - imp;
		System.out.println(suma);
		}
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class WSAOAE {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int [] array = new int[n];
		for(int i = 0; i < n; i++){
		array[i] = sc.nextInt();
		}
		//Ordenar el array de forma creciente
		Arrays.sort(array); //import Arrays.
		//Encuentra el impar menor.
		int imp = 0;
		for(int i = 0; i < n; i++){
		if(array[i] % 2 == 1){
			imp = imp + array[i];
			break;
		}
		}
	//	System.out.println(imp + " imp");
		//Ordenar el array de forma decreciente
		int [] arrayDec = new int[n];
		int i = (n-1);
		int j = 0;
		for(i = i, j = j; i >= 0 && j < n; i--, j++){
			arrayDec[j] = array[i];
	//		System.out.println(arrayDec[j] + "ar");
		}
		//Sumar todo.
		long suma = 0;
		for (int k = 0; k < arrayDec.length; k++) {
			suma += arrayDec[k];
	//		System.out.println(suma + "s");
			}
		if(suma % 2 == 0){
		System.out.println(suma);
		}
		else {
		suma = suma - imp;
		System.out.println(suma);
		}

	}

}


import java.util.Arrays;
import java.util.Scanner;

public class WSAOAE {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int [] array = new int[n];
		for(int i = 0; i < n; i++){
		array[i] = sc.nextInt();
		long suma = 0;
		for (int k = 0; k < array.length; k++) {
			suma += array[k];
			}
		if(suma % 2 == 0){
		System.out.println(suma);
		}
		else {
		Arrays.sort(array);
		int imp = 0;
		for(int a = 0; a < n; a++){
		if(array[a] % 2 == 1){
			imp = imp + array[a];
			break;
		}
		suma = suma - imp;
		System.out.println(suma);
		}
		}
		}
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class WSAOAE {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int [] array = new int[n];
		for(int i = 0; i < n; i++){
		array[i] = sc.nextInt();
		}
		long suma = 0;
		for (int k = 0; k < array.length; k++) {
			suma += array[k];
			}
		if(suma % 2 == 0){
		System.out.println(suma);
		}
		else {
		Arrays.sort(array);
		int imp = 0;
		for(int a = 0; a < n; a++){
		if(array[a] % 2 == 1){
			imp = imp + array[a];
			break;
		}
		suma = suma - imp;
		System.out.println(suma);
		}
		}
	}
}


import java.io.*;
import java.util.*;
public class WetSharkandOddandEven {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		String s = br.readLine();
		String [] input = s.split(" ");
		long [] integers = new long[input.length];
		long sum =0;
		for(int i=0;i<input.length;i++){
			integers[i] = Integer.parseInt(input[i]);
			sum += integers[i];
		}
		Arrays.sort(integers);
		if(sum % 2 == 0)
			System.out.println(sum);
		else {
			for(int i=0; i<integers.length;i++){
				sum = sum - integers[i];
				if( sum % 2 == 0 )
					break;
			}

			System.out.println(sum);
		}
	}

}


import java.io.*;
import java.util.*;
public class WetSharkandOddandEven {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		String s = br.readLine();
		String [] input = s.split(" ");
		long [] integers = new long[input.length];
		long sum =0;
		for(int i=0;i<input.length;i++){
			integers[i] = Integer.parseInt(input[i]);
			sum += integers[i];
		}
		Arrays.sort(integers);
		if(sum % 2 == 0)
			System.out.println(sum);
		else {
			for(int i=0; i<integers.length;i++){
				if(integers[i]%2==1){
					sum = sum - integers[i];
					break;
				}
			}
			System.out.println(sum);
		}
	}

}


import java.io.*;
import java.util.*;
public class WetSharkandOddandEven {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		String s = br.readLine();
		String [] input = s.split(" ");
		long [] integers = new long[input.length];
		long sum =0;
		for(int i=0;i<input.length;i++){
			integers[i] = Integer.parseInt(input[i]);
			sum += integers[i];
		}
		Arrays.sort(integers);
		if(sum % 2 == 0)
			System.out.println(sum);
		else {
				sum = sum - integers[integers.length-1];
			System.out.println(sum);
		}
	}

}


import java.io.*;
import java.util.*;
public class WetSharkandOddandEven {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		//Scanner sc = new Scanner( System.in );
		int n = Integer.parseInt(st.nextToken());
		String s = br.readLine();
		String [] input = s.split(" ");
		long [] integers = new long[input.length];
		long sum =0;
		for(int i=0;i<input.length;i++){
			integers[i] = Integer.parseInt(input[i]);
			sum += integers[i];
		}
		Arrays.sort(integers);
		if(sum % 2 == 0)
			System.out.println(sum);
		else {
			sum = sum - integers[0];
			System.out.println(sum);
		}
	}

}


import java.awt.image.SampleModel;
import java.io.*;
import java.util.*;
public class WetSharkandOddandEven {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		String s = br.readLine();
		String [] input = s.split(" ");
		long [] integers = new long[input.length];
		long sum =0;
		long smallest = 1000000000;
		for(int i=0;i<input.length;i++){
			integers[i] = Integer.parseInt(input[i]);
			sum += integers[i];
			if(integers[i]%2 == 1 && integers[i]<smallest)
				smallest = integers[i];
		}
		if(sum % 2 == 0)
			System.out.println(sum);
		else {
			sum = sum - smallest;
			System.out.println(sum);
		}
	}

}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x=sc.nextInt();
int[] arr = new int[x];
sc.nextLine();
int sum =0;
int count =0;
for(int i =0; i<x ;i++){
    int num =sc.nextInt();
    arr[i]=num;

    }
    for(int i =0;i<arr.length;i++){
    if(arr[i]%2==0){
        sum+=arr[i];
    }else{
        count++;
    }
    }
    if(count%2==0){
    for(int i =0;i<arr.length;i++){
        if(arr[i]%2!=0){
            sum+=arr[i];

        }
    }
    }else{
    int minSoFar =0;
    for (int i =0; i<arr.length;i++){
        if (arr[i]<minSoFar){
            minSoFar=arr[i];

        }
    }
    for(int i =0 ;i< arr.length ; i++){
        if(arr[i]%2!=0 && arr[i]!=minSoFar){
            sum+=arr[i];
        }
    }
    }

    }
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x=sc.nextInt();
int[] arr = new int[x];
sc.nextLine();
int sum =0;
int count =0;
for(int i =0; i<x ;i++){
    int num =sc.nextInt();
    arr[i]=num;

    }
    for(int i =0;i<arr.length;i++){
    if(arr[i]%2==0){
        sum+=arr[i];
    }else{
        count++;
    }
    }
    if(count%2==0){
    for(int i =0;i<arr.length;i++){
        if(arr[i]%2!=0){
            sum+=arr[i];

        }
    }
    }else{
    int minSoFar =0;
    for (int i =0; i<arr.length;i++){
        if (arr[i]<minSoFar){
            minSoFar=arr[i];

        }
    }
    for(int i =0 ;i< arr.length ; i++){
        if(arr[i]%2!=0 && arr[i]!=minSoFar){
            sum+=arr[i];
        }
    }
    }
        System.out.println(sum);
    }
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x=sc.nextInt();
int[] arr = new int[x];
sc.nextLine();
long sum =0l;
long count =0l;
for(int i =0; i<x ;i++){
    int num =sc.nextInt();
    arr[i]=num;

    }
    for(int i =0;i<arr.length;i++){
    if(arr[i]%2==0){
        sum+=arr[i];
    }else{
        count++;
    }
    }
    if(count%2==0){
    for(int i =0;i<arr.length;i++){
        if(arr[i]%2!=0){
            sum+=arr[i];

        }
    }
    }else{
    int minSoFar =1000000001;
    for (int i =0; i<arr.length;i++){
        if (arr[i]<minSoFar){
            minSoFar=arr[i];

        }
    }
    for(int i =0 ;i< arr.length ; i++){
        if(arr[i]%2!=0 ){
            sum+=arr[i];
        }
    }sum-=minSoFar;
    }
        System.out.println(sum);
    }
}