#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long int sumXOR(vector<long long> arr) {
  long long n = arr.size();
  long long sum = 0;
  for (long long i = 0; i < 60; i++) {
    long long zc = 0, oc = 0;
    long long idsum = 0;
    for (long long j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = oc * zc * ((1LL << i) % mod);
    sum += idsum;
    sum %= mod;
  }
  return (sum % mod);
}
void print_bits(const vector<long long>& a, int n) {
  for (auto ai : a) {
    for (int j = n; j >= 0; j--) {
      cout << ((ai >> j) & 1) << " ";
    }
    cout << endl;
  }
}
void naive(const vector<long long>& a, int n) {
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      ans += (a[i] ^ a[j]) % mod;
      ans %= mod;
    }
  }
  cout << "naive : " << ans << endl;
  cout << endl;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  long long ans = 0;
  long long xsum = 0;
  long long asum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << sumXOR(a) << endl;
  return 0;
}
