#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3fffffff;
const long long int INF = 0x3fffffffffffffff;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int mod = 1e9 + 7;
struct Mint {
  int val;
  Mint inv() const {
    int tmp, a = val, b = mod, x = 1, y = 0;
    while (b) tmp = a / b, a -= tmp * b, swap(a, b), x -= tmp * y, swap(x, y);
    return Mint(x);
  }

 public:
  Mint() : val(0) {}
  Mint(long long int x) {
    if ((val = x % mod) < 0) val += mod;
  }
  Mint pow(long long int t) {
    Mint res = 1, b = *this;
    while (t) {
      if (t & 1) res *= b;
      b *= b;
      t >>= 1;
    }
    return res;
  }
  Mint& operator+=(const Mint& x) {
    if ((val += x.val) >= mod) val -= mod;
    return *this;
  }
  Mint& operator-=(const Mint& x) {
    if ((val += mod - x.val) >= mod) val -= mod;
    return *this;
  }
  Mint& operator*=(const Mint& x) {
    val = (long long int)val * x.val % mod;
    return *this;
  }
  Mint& operator/=(const Mint& x) { return *this *= x.inv(); }
  Mint operator+(const Mint& x) const { return Mint(*this) += x; }
  Mint operator-(const Mint& x) const { return Mint(*this) -= x; }
  Mint operator*(const Mint& x) const { return Mint(*this) *= x; }
  Mint operator/(const Mint& x) const { return Mint(*this) /= x; }
};
struct factorial {
  vector<Mint> Fact, Finv;

 public:
  factorial(int maxx) {
    Fact.resize(maxx + 1), Finv.resize(maxx + 1);
    Fact[0] = Mint(1);
    for (int i = (0); i < (maxx); i++) Fact[i + 1] = Fact[i] * (i + 1);
    Finv[maxx] = Mint(1) / Fact[maxx];
    for (int i = (maxx); i > (0); i--) Finv[i - 1] = Finv[i] * i;
  }
  Mint fact(int n, bool inv = 0) {
    if (inv)
      return Finv[n];
    else
      return Fact[n];
  }
  Mint nPr(int n, int r) {
    if (n < 0 || n < r || r < 0)
      return Mint(0);
    else
      return Fact[n] * Finv[n - r];
  }
  Mint nCr(int n, int r) {
    if (n < 0 || n < r || r < 0)
      return Mint(0);
    else
      return Fact[n] * Finv[r] * Finv[n - r];
  }
};
int main() {
  int n;
  scanf("%d", &n);
  vector<long long int> a(n);
  for (int i = (0); i < (n); i++) scanf("%lld", &a[i]);
  int cnt[62] = {};
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (61); j++)
      if (a[i] >> j & 1) cnt[j]++;
  Mint ans;
  for (int i = (0); i < (n); i++) {
    int cnt2[62];
    for (int j = (0); j < (62); j++) cnt2[j] = cnt[j];
    for (int j = (0); j < (62); j++) {
      if (a[i] >> j & 1) {
        ans += Mint(2).pow(j) * Mint(n - cnt2[j]);
      } else
        ans += Mint(2).pow(j) * Mint(cnt2[j]);
    }
  }
  ans /= 2;
  printf("%d\n", ans.val);
  return 0;
}
