#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, tmp, result = 0, pow = 1;
  long long mod = 1000000007;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < 60; i++) {
    tmp = 0;
    for (long long j = 0; j < n; j++) {
      tmp += a[j] % 2;
      a[j] >>= 1;
    }
    result += tmp * (n - tmp) * pow;
    result %= mod;
    pow *= 2;
    pow %= mod;
  }
  cout << result << endl;
}
