#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793;
const long long mod = 1e9 + 7;
const long long LLMAX = numeric_limits<long long>::max();
void No() { cout << "No" << endl; }
void Yes() { cout << "Yes" << endl; }
long long id(char c) { return c - 'a'; }
bool isOK(vector<long long>& a, long long k, long long index) {
  return a[index] < k * (index + 1);
}
long long binary_search(vector<long long>& a, long long k) {
  long long left = -1;
  long long right = (long long)a.size();
  while (right - left > 1) {
    long long mid = left + (right - left) / 2;
    if (isOK(a, k, mid))
      right = mid;
    else
      left = mid;
  }
  return right;
}
template <class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
  return os << "{" << p.first << "," << p.second << "}";
}
template <class t>
ostream& operator<<(ostream& os, const vector<t>& v) {
  os << "{";
  for (auto e : v) os << e << ",";
  return os << "}";
}
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  for (long long d = 0; d < 60; d++) {
    long long zero = 0;
    long long one = 0;
    long long o = 1;
    for (long long i = 0; i < N; i++) {
      if ((A[i] & (o << d)) == 0) {
        zero++;
      } else {
        one++;
      }
    }
    ans += (zero * one) * ((o << d) % mod);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
