#include <bits/stdc++.h>
using namespace std;
long long power(long long k, long long n, int M) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * k % M;
    k = k * k % M;
    n /= 2;
  }
  return res;
}
int counter[61];
int main() {
  int N;
  long long A[200010];
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", A + i);
    for (int j = 0; j < 60; j++) {
      counter[j] += !!(A[i] & (1LL << j));
    }
  }
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      if (A[i] & (1LL << j)) {
        ans += (N - counter[j]) * (1LL << j);
      } else {
        ans += counter[j] * (1LL << j);
      }
      ans %= 1000000007;
    }
  }
  ans = ans * power(2, 1000000007 - 2, 1000000007) % 1000000007;
  cout << ans << endl;
  return 0;
}
