#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int mo = 1e9 + 7;
constexpr int mod = mo;
constexpr int inf = 1 << 30;
constexpr int mo2 = 998244353;
constexpr ll infl = 1ll << 60;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<ll> a(n);
  for (auto& b : a) cin >> b;
  ll sum = 0ll;
  for (int i = 60; i >= 0; i--) {
    int count = 0;
    for (int j = n - 1; j >= 0; j--) {
      if (a[j] & 1ll << i) {
        count++;
      }
    }
    ll tmp = count * (1ll << i);
    tmp %= mo;
    (tmp *= (n - count)) %= mo;
    (sum += tmp) %= mo;
  }
  cout << sum << endl;
  return 0;
}
