#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  ll ns;
  vector<ll> n0(61);
  vector<ll> n1(61);
  for (int i = 0; i < (61); ++i) {
    n0.at(i) = 0;
    n1.at(i) = 0;
  }
  for (int i = 0; i < (n); ++i) {
    cin >> ns;
    for (int j = 0; j < (61); ++j) {
      if (ns % 2 == 0) {
        n0.at(j)++;
      } else {
        n1.at(j)++;
      }
      ns /= 2;
    }
  }
  ll a = 0;
  ll b = 0;
  ll c = 1;
  for (int i = 0; i < (61); ++i) {
    b = n0.at(i) * n1.at(i);
    if (b >= 1000000007) b %= 1000000007;
    b = b * c;
    if (b >= 1000000007) b %= 1000000007;
    a += b;
    if (a >= 1000000007) a %= 1000000007;
    c *= 2;
    if (a >= 1000000007) c %= 1000000007;
  }
  cout << a << endl;
}
