#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < (n); ++i) cin >> v[i];
  long long ans = 0;
  for (int i = 0; i < (60); ++i) {
    int x = 0;
    for (int j = 0; j < (n); ++j) x += (v[j] >> i & 1) ? 1 : 0;
    int y = n - x;
    int tans = x * y % MOD;
    for (int j = 0; j < (i); ++j) {
      tans *= 2;
      tans %= MOD;
    }
    ans += tans;
    ans %= MOD;
  }
  cout << ans << endl;
}
