#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln = '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  int F[65][2];
  for (int i = 0; i < (65); i++)
    for (int j = 0; j < (2); j++) F[i][j] = 0;
  for (int i = 0; i < (n); i++) {
    ll a;
    cin >> a;
    for (int j = 0; j < (60); j++) {
      if ((a >> j) & 1)
        F[j][1]++;
      else
        F[j][0]++;
    }
  }
  ll res = 0;
  for (int i = 0; i < (60); i++) {
    ll a = F[i][0], b = F[i][1];
    ll sum = (a * b) % MOD;
    sum = (sum * (1LL << i)) % MOD;
    res = (res + sum) % MOD;
  }
  cout << res << ln;
}
