#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18L + 1;
const long long mod = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < (N); ++i) cin >> a[i];
  vector<int> count(61, 0);
  for (int i = 0; i < (N); ++i)
    for (int j = 0; j < (61); ++j) {
      if (a[i] >> j & 1) count[j]++;
    }
  long long ans = 0;
  for (int i = 0; i < (61); ++i) {
    long long comb = (count[i] * (N - count[i])) % mod;
    ans = (ans + (comb * (1LL << i) % mod) % mod) % mod;
  }
  cout << ans << endl;
  return 0;
}
