#include <bits/stdc++.h>
using namespace std;
vector<pair<string, pair<int, int> > > vec;
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
void solve(long long N, vector<long long> A) {
  vector<long long> sum(60), res(60);
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < 60; j++) {
      if (A[i] & (1ull << j)) sum[j]++;
    }
  }
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < 60; j++) {
      if ((A[i] & (1ull << j)) == 0)
        res[j] += sum[j];
      else
        res[j] += N - sum[j];
    }
  }
  long long resn = 0, two = 1;
  for (long long i = 0; i < 60; i++) {
    resn = (resn + res[i] * two) % 1000000007;
    two = two * 2 % 1000000007;
  }
  resn = resn * modinv(2, 1000000007) % 1000000007;
  cout << resn << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  vector<long long> A(N - 1 + 1);
  for (int i = 0; i <= N - 1; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, A);
  return 0;
}
