#include <bits/stdc++.h>
using namespace std;
const long long INF = 10e15;
const long long MINF = -10e10;
const int mod = 1000000007;
const double PI = 3.14159265358979323846;
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; }
};
int main() {
  int n;
  cin >> n;
  vector<long long> numbers(n);
  for (long long i = 0; i < (n); ++i) cin >> numbers[i];
  vector<int> zeros(61, 0), ones(61, 0);
  for (long long a : numbers) {
    for (int i = 0; i <= 60; i++) {
      int b = a % 2;
      if (b)
        ones[i]++;
      else
        zeros[i]++;
      a /= 2;
    }
  }
  vector<long long> conb(61, 0);
  for (long long i = 0; i < (61); ++i) conb[i] = zeros[i] * ones[i];
  mint ans = 0;
  for (long long i = 0; i < (61); ++i) {
    mint now = mint(2).pow(i) * conb[i];
    ans += now;
  }
  cout << ans.x << endl;
}
