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