#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  vector<long long> count(60, 0);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    int x = 0;
    while (A.at(i) > 0) {
      if (A.at(i) & 1) count.at(x)++;
      A.at(i) >>= 1;
      x++;
    }
  }
  long long ans = 0;
  long long n = 1;
  for (int i = 0; i < 60; i++) {
    ans += count.at(i) * (N - count.at(i)) * n % 1000000007LL;
    ans %= 1000000007LL;
    n *= 2LL;
  }
  cout << ans << endl;
}
