#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long n, a[300002];
unsigned long long ans = 0;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (long long j = 0; j < 60; j++) {
    long long cnt0 = 0, cnt1 = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] & ((unsigned long long)1 << j))
        cnt1++;
      else
        cnt0++;
    }
    ans += cnt0 * cnt1 * ((unsigned long long)1 << j);
    ans %= mod;
  }
  cout << ans << "\n";
}
