#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
const int INF = 1001001001;
int main() {
  int n;
  cin >> n;
  vector<int> count_1(60, 0);
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    for (int j = 0; j < 60; j++) {
      int x = a & (long long)1;
      count_1.at(j) += x;
      a >>= 1;
      if (a == 0) break;
    }
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long a = count_1.at(i) * (n - count_1.at(i)) % mod;
    for (int j = 0; j < i; j++) {
      a = a * 2 % mod;
    }
    ans = (ans + a) % mod;
  }
  cout << ans << endl;
}
