#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct mint {
  long long x;
  mint() : x(0) {}
  mint(long long x) : x((x % mod + mod) % mod) {}
  mint& fix() {
    x = (x % mod + mod) % mod;
    return *this;
  }
  mint operator-() const { return mint(0) - *this; }
  mint operator~() const { return mint(1) / *this; }
  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) {
    (x *= a.pow(mod - 2).x) %= mod;
    return *this;
  }
  mint operator+(const mint& a) const { return mint(*this) += a; }
  mint operator-(const mint& a) const { return mint(*this) -= a; }
  mint operator*(const mint& a) const { return mint(*this) *= a; }
  mint operator/(const mint& a) const { return mint(*this) /= a; }
  mint pow(long long t) const {
    if (!t) return 1;
    mint res = pow(t / 2);
    res *= res;
    return (t & 1) ? res * x : res;
  }
  bool operator<(const mint& a) const { return x < a.x; }
  bool operator==(const mint& a) const { return x == a.x; }
};
mint ex(mint x, long long t) { return x.pow(t); }
istream& operator>>(istream& i, mint& a) {
  i >> a.x;
  return i;
}
ostream& operator<<(ostream& o, const mint& a) {
  o << a.x;
  return o;
}
struct comb {
  vector<mint> f, g;
  comb() {}
  comb(int mx) : f(mx + 1), g(mx + 1) {
    f[0] = 1;
    for (int i = 1; i <= mx; ++i) f[i] = f[i - 1] * i;
    g[mx] = f[mx].pow(mod - 2);
    for (int i = mx; i > 0; i--) g[i - 1] = g[i] * i;
  }
  mint c(int a, int b) {
    if (a < b) return 0;
    return f[a] * g[b] * g[a - b];
  }
} c(3e6);
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  mint ans = 0;
  for (int i = 0; i <= n - 1; ++i) cin >> a[i];
  for (int i = 0; i <= 60; ++i) {
    int a1 = 0;
    for (int j = 0; j <= n - 1; ++j) {
      a1 += (a[j] % 2);
      a[j] = a[j] >> 1;
    }
    ans = ans + a1 * (n - a1) * pow(2, i);
  }
  cout << ans << endl;
  return 0;
}
