#include <bits/stdc++.h>
using namespace std;
const int 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 powg(long long a, long long b) {
  if (b == 0)
    return 1;
  else if (b == 1)
    return a;
  else if (b % 2 == 0)
    return powg(a * a, b / 2);
  else
    return a * powg(a * a, (b - 1) / 2);
}
int main() {
  long long n;
  cin >> n;
  vector<map<long long, long long>> keta(60);
  for (int i = 0; i < (n); ++i) {
    long long a;
    cin >> a;
    for (int j = 0; j < (60); ++j) {
      if (a & (1LL << j))
        keta[j][1]++;
      else
        keta[j][0]++;
    }
  }
  mint ans = 0;
  for (int i = 0; i < (60); ++i) {
    ans += powg(2, i) * keta[i][1] * keta[i][0];
  }
  cout << ans << endl;
}
