#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;
template <class T>
using vv = vector<vector<T>>;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int N;
  cin >> N;
  vint keta_flag_kazu(60);
  for (int _ = int(0), ___b = int(N), ___c = int(1); _ < ___b; _ += ___c) {
    ll A;
    cin >> A;
    for (int i = int(0), i__b = int(60), i__c = int(1); i < i__b; i += i__c) {
      keta_flag_kazu[i] += A >> i & 1;
    }
  }
  ll ans = 0;
  for (int i = int(0), i__b = int(60), i__c = int(1); i < i__b; i += i__c) {
    ll k = keta_flag_kazu[i] * (N - keta_flag_kazu[i]) % MOD;
    ll b = (1ll << i) % MOD;
    ans += k * b % MOD;
  }
  cout << ans;
}
