#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using ll = long long;
const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);
using namespace std;
void scans(string& str) {
  char c;
  scanf("%c", &c);
  if (c == '\n') scanf("%c", &c);
  while (c != '\n' && c != -1) {
    str += c;
    scanf("%c", &c);
  }
}
void scanc(char& str) {
  char c;
  scanf("%c", &c);
  if (c == -1) return;
  while (c == '\n') {
    scanf("%c", &c);
  }
  str = c;
}
double acot(double x) { return PI / 2 - atan(x); }
template <int mod>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt& operator+=(const ModInt& push) {
    if ((x += push.x) >= mod) x -= mod;
    return *this;
  }
  ModInt& operator-=(const ModInt& push) {
    if ((x += mod - push.x) >= mod) x -= mod;
    return *this;
  }
  ModInt& operator*=(const ModInt& push) {
    x = (int)(1LL * x * push.x % mod);
    return *this;
  }
  ModInt& operator/=(const ModInt& push) {
    *this *= push.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt& push) const { return ModInt(*this) += push; }
  ModInt operator-(const ModInt& push) const { return ModInt(*this) -= push; }
  ModInt operator*(const ModInt& push) const { return ModInt(*this) *= push; }
  ModInt operator/(const ModInt& push) const { return ModInt(*this) /= push; }
  bool operator==(const ModInt& push) const { return x == push.x; }
  bool operator!=(const ModInt& push) const { return x != push.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while (n > 0) {
      if (n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream& operator<<(ostream& os, const ModInt& push) {
    return os << push.x;
  }
  friend istream& operator>>(istream& is, ModInt& a) {
    int64_t t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  static int get_mod() { return mod; }
};
using modint = ModInt<MOD>;
int main() {
  ll n;
  scanf("%lld", &n);
  vector<ll> a(n);
  vector<ll> count(60 + 1);
  for (int i = 0; i < (n); ++i) {
    scanf("%lld", &a[i]);
    for (int j = 0; j < (61); ++j) {
      if (a[i] & (1LL << (ll)j)) ++count[j];
    }
  }
  modint ans = 0;
  for (int i = 0; i < (61); ++i) {
    ans +=
        ((count[i] % MOD) * ((n - count[i]) % MOD) * ((1LL << (ll)i) % MOD)) %
        MOD;
  }
  cout << ans << endl;
  return 0;
}
