#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
const int mod = 1000000007;
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 += -a.x + mod) >= 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 == 0) 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;
  }
  friend ostream& operator<<(ostream& s, mint a) { return s << a.x; }
};
mint P[70];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  P[0] = 1;
  for (int i = 1; i < (70); ++i) P[i] = P[i - 1] * 2;
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  mint ans = 0;
  for (int i = 0; i < (n); ++i) ans += a[i] * (n - 1);
  vector<int> table(70);
  for (int i = 0; i < (n); ++i) {
    int keta = 0;
    while (a[i]) {
      if (a[i] % 2) table[keta]++;
      keta++;
      a[i] /= 2;
    }
  }
  for (int i = 0; i < (70); ++i) {
    if (table[i] >= 2) ans -= (mint)table[i] * (table[i] - 1) / 2 * P[i + 1];
  }
  cout << ans << endl;
}
