#include <bits/stdc++.h>
using namespace std;
int n;
vector<int64_t> arr;
int64_t dp[65];
int64_t ans[128];
const int64_t mod = 1e9 + 7;
int64_t bforce(vector<int64_t> arr) {
  int64_t bans = 0;
  int n = arr.size();
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      bans += arr[i] ^ arr[j];
      bans %= mod;
    }
  }
  return bans;
}
int main() {
  int64_t fans = 0, bans = 0;
  fans = 0;
  bans = 0;
  for (int i = 0; i < 64; ++i) dp[i] = 0;
  for (int j = 0; j < 128; ++j) ans[j] = 0;
  cin >> n;
  arr.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; ++i) {
    long long tmp = arr[i];
    int pos = 0;
    while (tmp) {
      if (tmp & 1LL) {
        dp[pos]++;
      }
      pos++;
      tmp >>= 1;
    }
  }
  for (int i = 0; i < 65; ++i) {
    ans[i] += (dp[i] * (n - dp[i]));
  }
  int64_t po2 = 1;
  assert(fans == 0);
  for (int i = 0; i < 128; ++i) {
    if (ans[i]) {
      fans += ((po2 * ans[i]) % mod);
      fans %= mod;
    }
    po2 *= 2LL;
    po2 %= mod;
  }
  cout << fans << "\n";
  return 0;
}
