#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const long long int MOD = 1e9 + 7;
const long long int LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
class CompareDist {
 public:
  bool operator()(pair<long long int, long long int> n1,
                  pair<long long int, long long int> n2) {
    if (n1.first != n2.first)
      return n1.first < n2.first;
    else
      return n1.second < n2.second;
  }
};
__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
signed main() {
  int n;
  cin >> n;
  int bits[62];
  long long int ans = 0;
  for (int i = 0; i < (int)(62); i++) bits[i] = 0;
  for (int i = 0; i < (int)(n); i++) {
    long long int a;
    cin >> a;
    for (int j = 0; j < (int)(61); j++) {
      if (a % 2 == 0) bits[j]++;
      a /= 2;
    }
  }
  long long int keta = 1;
  for (int i = 0; i < (int)(62); i++) {
    long long int sum = (bits[i] * (n - bits[i])) % MOD;
    sum *= keta;
    sum %= MOD;
    keta *= 2;
    keta %= MOD;
    ans += sum;
    ans %= MOD;
  }
  ans = (ans + MOD) % MOD;
  cout << ans << endl;
  return 0;
}
