#include <bits/stdc++.h>
using namespace std;
string vow = "aeiou";
const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
const long double pie = 3.14159265358979;
const long long mod = 1e9 + 7;
void solve(int test_case) {
  int n;
  cin >> n;
  vector<int> bit(62);
  for (int i = 0; i < n; i++) {
    long long val;
    cin >> val;
    for (int j = 0; j < 62; j++) {
      int temp = (val & 1);
      val >>= 1;
      if (temp) bit[j]++;
    }
  }
  long long f = 1;
  long long ans = 0;
  for (int j = 0; j < 62; j++) {
    long long one = bit[j];
    long long zero = n - one;
    long long temp = one * zero * f;
    temp %= mod;
    ans += temp;
    ans %= mod;
    f <<= 1;
    f %= mod;
  }
  cout << ans;
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int i = 0; i < t; i++) solve(i);
  return 0;
}
