#include <bits/stdc++.h>
using namespace std;
using dou = long double;
string yes = "yes";
string Yes = "Yes";
string YES = "YES";
string no = "no";
string No = "No";
string NO = "NO";
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long mod = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  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) 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 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
long long ceil(long long a, long long b) { return ((a + b - 1) / b); }
const int INF = 2000000000;
const long long INF64 = 3223372036854775807ll;
const long long MOD = 1000000007ll;
const dou pi = 3.141592653589793;
int main() {
  int n;
  std::cin >> n;
  std::vector<long long> a(n);
  for (long long i = 0; i < (int)(n); i++) std::cin >> a[i];
  ;
  std::vector<long long> c(62);
  for (long long i = 0; i < (int)(n); i++) {
    for (long long j = 0; j < (int)(62); j++)
      if (a[i] & long long(1ll << j)) {
        c[j]++;
      }
  }
  long long ans = 0;
  for (long long i = 0; i < (int)(62); i++) {
    ans += ((long long(powl(2, i)) % MOD) * c[i] * (n - c[i])) % MOD;
    ans %= MOD;
  }
  std::cout << ans << std::endl;
}
