#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<str>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
const ld PI = (acos(-1));
const ll MOD = 1000000007;
struct __io_async {
  __io_async() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};
struct Mint {
  static constexpr ll MOD = 1000000007;
  Mint() : num(1ll) {}
  Mint(ll num_) : num(num_ % MOD) {}
  Mint(const Mint& Mint) : num(Mint.num % MOD) {}
  ll get() const { return num; }
  operator ll() const { return num; }
  ll operator*() { return num; }
  Mint& operator+=(const Mint& r) {
    (num += r.num) %= MOD;
    return *this;
  }
  Mint& operator-=(const Mint& r) {
    ((num += -r.num) < 0) ? (num += MOD) : num;
    return *this;
  }
  Mint& operator*=(const Mint& r) {
    (num *= r.num) %= MOD;
    return *this;
  }
  Mint& operator/=(const Mint& r) {
    (num *= r.inv().num) %= MOD;
    return *this;
  }
  Mint& operator+=(const ll& r) {
    (num += r) %= MOD;
    return *this;
  }
  Mint& operator-=(const ll& r) {
    (num += -r + MOD) %= MOD;
    return *this;
  }
  Mint& operator*=(const ll& r) {
    (num *= r) %= MOD;
    return *this;
  }
  Mint& operator/=(const ll& r) {
    (num *= Mint(r).inv().num) %= MOD;
    return *this;
  }
  Mint operator+(const Mint& r) const { return Mint(*this) += r; }
  Mint operator-(const Mint& r) const { return Mint(*this) -= r; }
  Mint operator*(const Mint& r) const { return Mint(*this) *= r; }
  Mint operator/(const Mint& r) const { return Mint(*this) /= r; }
  Mint operator+(const ll& r) const { return *this + Mint(r); }
  Mint operator-(const ll& r) const { return *this - Mint(r); }
  Mint operator*(const ll& r) const { return *this * Mint(r); }
  Mint operator/(const ll& r) const { return *this / Mint(r); }
  Mint inv() const {
    ll a = num, b = MOD, x = 1, y = 0;
    while (b) {
      ll q = a / b;
      a -= b * q;
      swap(a, b);
      x -= y * q;
      swap(x, y);
    }
    return ((x %= MOD) < 0) ? x += MOD : x;
  }
  Mint pow(const Mint& r) const {
    ll res = 1;
    ll x = num;
    ll n = r.num;
    while (n > 0) {
      if (n & 1) res = (res * x) % MOD;
      x = (x * x) % MOD;
      n >>= 1;
    }
    return res;
  }

 private:
  ll num;
  inline void swap(ll& a, ll& b) const {
    ll tmp = a;
    a = b;
    b = tmp;
  }
};
ostream& operator<<(ostream& stream, const Mint& val) {
  stream << val.get();
  return stream;
}
int main() {
  ll n;
  cin >> n;
  vll cnt(60, 0);
  vector<bitset<60>> vb(n);
  for (ll i = ((ll)0); i < ((ll)n); ++i) {
    ll a;
    cin >> a;
    bitset<60> b(a);
    for (ll j = ((ll)0); j < ((ll)60); ++j) {
      if (b[j]) cnt[j]++;
    }
  }
  Mint ans = 0LL;
  for (ll i = ((ll)0); i < ((ll)60); ++i) {
    Mint tmp = cnt[i];
    tmp *= n - cnt[i];
    tmp *= (1LL << i);
    ans += tmp;
  }
  cout << ans << "\n";
  return 0;
}
