#include <bits/stdc++.h>
using namespace std;
long long gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) { return (x * y) / gcd(x, y); }
long mod = 1000000007;
typedef struct mint {
  long long x;
  mint(long long x = 0) : x(x % 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(long long 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;
  }
} mint_t;
long long intpow(mint_t m, int n) {
  if (n == 0) return 1;
  mint_t ans(1);
  while (n >= 1) {
    if ((n % 2) == 0) {
      m *= m.x;
      n /= 2;
    } else {
      ans *= m.x;
      n -= 1;
    }
  }
  return ans.x;
}
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};
int main() {
  int n;
  cin >> n;
  vector<long long> a;
  for (int i = 0; i < (int)(n); i++) {
    long long tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  int bit_num[60] = {0};
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(60); j++) {
      if (a[i] >> j & 1) bit_num[j]++;
    }
  }
  mint ans = 0;
  mint mut = 1;
  for (int i = 0; i < (int)(60); i++) {
    mint plus = bit_num[i] * (n - bit_num[i]);
    plus *= mut;
    ans += plus;
    mut *= 2;
  }
  cout << ans.x << endl;
}
