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