#include <bits/stdc++.h>
using namespace std;
static const int MAX = 10000;
static const long long INFTY = 1e18;
static const long long MOD = 1e9 + 7;
struct edge {
  long long to, cost;
};
using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
vector<bool> seen;
vector<int> colors;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    cin >> A[i];
  }
  long long ans = 0;
  for (int i = 0, i_len = (61); i < i_len; ++i) {
    long long num1 = 0;
    long long num0 = 0;
    for (int j = 0, j_len = (N); j < j_len; ++j) {
      if ((A[j] >> i) & 1LL)
        num1++;
      else
        num0++;
    }
    long long keta = 1LL << i;
    long long tmp = keta * num1;
    tmp %= MOD;
    tmp = tmp * num0;
    tmp %= MOD;
    ans += tmp;
    ans %= MOD;
  }
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
