#include <bits/stdc++.h>
using namespace std;
template <class T>
bool inline rmn(T& a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool inline rmx(T& a, T b) {
  return a < b ? (a = b, true) : false;
}
const long long INFLL = 0x7f7f7f7f7f7f7f7f, MOD = 1e9 + 7;
const int INF = 0x7f7f7f7f;
vector<vector<int>> adj;
vector<int> vis, color;
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1},
    dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
inline long long mexp(long long x, long long n, long long m = MOD) {
  long long res = 1;
  x %= m;
  while (n) {
    if (n & 1) res = (res * x) % m;
    n >>= 1;
    x = (x * x) % m;
  }
  return res;
}
inline long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  while (a > 0 && b > 0) {
    if (a > b)
      a %= b;
    else
      b %= a;
  }
  return a + b;
}
template <int MOD>
struct Modular {
  int value;
  static const int MOD_value = MOD;
  Modular(long long v = 0) {
    value = v % MOD;
    if (value < 0) value += MOD;
  }
  Modular(long long a, long long b) : value(0) {
    *this += a;
    *this /= b;
  }
  Modular& operator+=(Modular const& b) {
    value += b.value;
    if (value >= MOD) value -= MOD;
    return *this;
  }
  Modular& operator-=(Modular const& b) {
    value -= b.value;
    if (value < 0) value += MOD;
    return *this;
  }
  Modular& operator*=(Modular const& b) {
    value = (long long)value * b.value % MOD;
    return *this;
  }
  friend Modular mexp(Modular a, long long e) {
    Modular res = 1;
    while (e) {
      if (e & 1) res *= a;
      a *= a;
      e >>= 1;
    }
    return res;
  }
  friend Modular inverse(Modular a) { return mexp(a, MOD - 2); }
  Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
  friend Modular operator+(Modular a, Modular const b) { return a += b; }
  friend Modular operator-(Modular a, Modular const b) { return a -= b; }
  friend Modular operator-(Modular const a) { return 0 - a; }
  friend Modular operator*(Modular a, Modular const b) { return a *= b; }
  friend Modular operator/(Modular a, Modular const b) { return a /= b; }
  friend std::ostream& operator<<(std::ostream& os, Modular const& a) {
    return os << a.value;
  }
  friend bool operator==(Modular const& a, Modular const& b) {
    return a.value == b.value;
  }
  friend bool operator!=(Modular const& a, Modular const& b) {
    return a.value != b.value;
  }
};
int32_t main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed;
  cerr << fixed;
  cout << setprecision(10);
  cerr << setprecision(3);
  int n;
  cin >> n;
  vector<int> ct(60, 0);
  for (int i = 0; i < n; ++i) {
    long long t;
    cin >> t;
    for (int b = 0; t; ++b, t >>= 1)
      if (t & 1LL) ++ct[b];
  }
  Modular<MOD> ans = 0, pow = 1;
  for (int i = 0; i < 60; ++i, pow *= 2) {
    ans += ct[i] * (n - ct[i]) * pow;
  }
  cout << ans << '\n';
  return 0;
}
