#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000")
#pragma warning(disable : 6031)
#pragma warning(disable : 4244)
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long mod = int(1e9) + 7;
const double eps9 = 1e-9;
long long test(vector<long long>& a) {
  long long res = 0;
  for (int i = 0; i < (int)(a).size() - 1; i++)
    for (int j = i + 1; j < (int)(a).size(); j++) {
      res = (res + (a[i] ^ a[j]) % mod) % mod;
    }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << setprecision(18) << fixed;
  int n;
  cin >> n;
  vector<long long> a(n);
  for (long long& i : a) cin >> i;
  vector<long long> res(63);
  for (int bit = 0; bit < 63; bit++) {
    long long zc = 0, oc = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] & (1LL << bit))
        oc++;
      else
        zc++;
    }
    res[bit] = zc * oc;
  }
  long long final_res = 0;
  for (int bit = 0; bit < 63; bit++) {
    final_res =
        (final_res + (res[bit] % mod * ((1LL << bit) % mod)) % mod) % mod;
  }
  cout << final_res % mod;
  cout << endl << test(a);
  return 0;
}
