#include <bits/stdc++.h>
template <typename T1, typename T2>
inline void chmin(T1& a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1& a, T2 b) {
  if (a < b) a = b;
}
const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kMax9 = 1000000010;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;
const long long kMod = 1000000007;
const long long kMAX = 1000000000;
using namespace std;
using ll = long long;
inline int readInt() {
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  int sigma = 1;
  if (c == '-') {
    sigma = -1;
    c = getchar();
  }
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * sigma;
}
template <class T>
void PrintVector(const vector<T>& v) {
  for (const auto& e : v) {
    cout << e << endl;
  }
}
template <class T>
void PrintVector(const vector<T>& v, int n) {
  for (long i = (0); i <= (n - 1); ++i) {
    cout << v[i] << endl;
  }
}
double dist(double lhs, double rhs) { return sqrt(lhs * lhs + rhs * rhs); }
const long km = 62;
long n, m, k, t;
string binary(int dec) {
  string s;
  while (dec > 0) {
    s.push_back((dec % 2) + '0');
    dec /= 2;
  }
  auto j = km - long(s.size());
  for (long i = (0); i <= (j - 1); ++i) {
    s.push_back('0');
  }
  return s;
}
int main() {
  long ans = 0;
  vector<string> ss;
  vector<long> cnt;
  cin >> n;
  for (long i = (0); i <= (n - 1); ++i) {
    ll a0;
    cin >> a0;
    auto s0 = binary(a0);
    ss.push_back(s0);
  }
  for (long i = (0); i <= (km - 1); ++i) {
    long x = 0;
    long y = 0;
    for (long j = (0); j <= (n - 1); ++j) {
      if (ss[j][i] == '0') {
        ++x;
      } else {
        ++y;
      }
    }
    ans = (ans + x * y * (1 << i)) % kMod;
  }
  cout << ans << endl;
  return 0;
}
