#include <bits/stdc++.h>
using namespace std;
void ans(bool x) {
  if (x)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
const long long int INF = 1001001001;
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
  }
  int ans = 0;
  int m = 1;
  for (int i = 0; i < (int)(60); i++) {
    int a1 = 0;
    for (int j = 0; j < (int)(n); j++) {
      if (a[j] >> i & 1) {
        a1 += 1;
        a1 % mod;
      }
    }
    long long int now = a1 * (n - a1) % mod;
    now = now * m % mod;
    ans += now;
    ans %= mod;
    m = m * 2;
    m %= mod;
  }
  cout << ans << endl;
}
