#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll M;
    cin >> M;
    vector<pair<ll,ll>> A;
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        A.push_back(make_pair(a,b));
    }
    ll sum = 0;
    ll dig = 0;
    for (int i = 0; i < M; ++i) {
        sum += A[i].first * A[i].second;
        dig += A[i].second;
    }
    cout << (dig-1) + (sum-1)/9 << endl;
}

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

ll n, sum, ans, res;
ll a[N], p[70];

void rd(ll &ans)
{
    ans = 0; ll f = 1;
    char x = getchar();
    while(x > '9' || x < '0') {if(x == '-') f = -1; x = getchar();}
    while(x >= '0' && x <= '9') ans = ans * 10 + x - '0', x = getchar();
    ans *= f;
}

void insert(ll x)
{
    for(int i = 60; ~i; i --)
        if(x & (1LL << i))
        {
            if(p[i]) x ^= p[i];
            else {p[i] = x; break;}
        }
}

int main()
{
    rd(n);
    for(int i = 1; i <= n; i ++) rd(a[i]), sum ^= a[i];
    for(int i = 0; i < 60; i ++)
    {
        if((sum & (1LL << i)) == 0) continue;
        ans += (1LL << i);
        for(int j = 1; j <= n; j ++)
            if(a[j] & (1LL << i)) a[j] ^= (1LL << i);
    }
    for(int i = 1; i <= n; i ++) insert(a[i]);
    for(int i = 60; ~i; i --) res = max(res, res ^ p[i]);
    printf("%lld", ans + (res << 1));
    return 0;
}