#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 1000000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    constexpr ll mod = inf;
    int n; cin >> n;
    vector<ll> a(n);
    vector<vector<ll>> cnt(n, vector<ll>(63));
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        for (int j = 0; j < 63; ++j) {
            cnt[i][j] += a[i] >> j & 1;
        }
    }

    for (int j = 0; j < 63; ++j) {
        for (int i = n - 2; i >= 0; --i) {
            cnt[i][j] += cnt[i + 1][j];
        }
    }

    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 63; ++j) {
            if (cnt[i][j] == 0) continue;

            if (a[i] >> j & 1) {
                ans += (1LL << j) % mod * (n - i - cnt[i][j]);
            }
            else {
                ans += (1LL << j) % mod * (cnt[i][j]);
            }
            ans %= mod;
        }
    }

    // ll ans2 = 0;
    // for (int i = 0; i < n; ++i) {
    //     for (int j = i + 1; j < n; ++j) {
    //         ans2 += a[i] ^ a[j];
    //         ans2 %= mod;
    //     }
    // }

    cout << ans << " " << ans2 <<endl;
    return 0;
}