#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int, int>;
using Mll = map<ll, ll>;
using UMi = unordered_map<int, int>;
using UMll = unordered_map<ll, ll>;
using Pi = pair<int, int>;
using Pll = pair<ll, ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int, vector<int>, greater<int>>;
using pqsi = priority_queue<int, vector<int>, less<int>>;
using pqgll = priority_queue<int, vector<int>, greater<int>>;
using pssll = priority_queue<int, vector<int>, less<int>>;
template <class T>
using vec = vector<T>;
const long long MOD = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
long long N;
vector<long long> A;
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> N;
  A.resize(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  mint ans = 0;
  for (long long bit = 0; bit < 60; bit++) {
    long long zero = 0LL;
    long long one = 0LL;
    for (long long i = 0; i < N; i++) {
      if (A[i] & (1LL << bit))
        one++;
      else
        zero++;
    }
    ans += mint(one * zero * (1LL << bit));
  }
  cout << ans.x << "\n";
  return 0;
}
