#include <bits/stdc++.h>
using namespace std;
const long long MAXFACT = (long long)1e9 + 7;
int main() {
  long long N;
  cin >> N;
  long long A[N];
  long long ans;
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  ans = 0;
  for (long long i = 0; i < 60; i++) {
    long long count;
    count = 0;
    long long a = 1;
    for (long long ii = 1; ii <= i; ii++) {
      a *= 2;
    }
    for (long long j = 0; j < N; j++) {
      if ((A[j] & a) == a) {
        count++;
      }
    }
    long long aa = a % MAXFACT;
    ans += count * (N - count) * aa % MAXFACT;
    ans %= MAXFACT;
  }
  cout << ans << endl;
  return 0;
}
