#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<pair<int, int> > cnt(60);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if ((a[i] >> j) & (long long)1)
        cnt[j].first++;
      else
        cnt[j].second++;
    }
  }
  long long ans = 0;
  long long bit = 1;
  for (int i = 0; i < 60; i++) {
    long long num;
    num = (long long)cnt[i].first * cnt[i].second;
    ans += num * bit;
    ans %= mod;
    bit *= 2;
    bit %= mod;
  }
  cout << ans << endl;
}
