#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
const long long MOD = 1000000007;
const long long INF = MOD * MOD;
long long n, m, k, ans;
string s, t;
const long long powll = 1LL << 1;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long bit[60] = {};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if ((a[i] >> j) & 1) bit[j]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long tmp = (1LL << i) % MOD;
    tmp = (tmp * bit[i]) % MOD;
    tmp = (tmp * (n - bit[i])) % MOD;
    ans += tmp;
  }
  cout << ans << "\n";
}
