#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
struct mint {
  int n;
  mint(int n_ = 0) : n(n_ % MOD) {
    if (n < 0) n += MOD;
  }
};
mint operator+(mint a, mint b) { return (a.n += b.n) >= MOD ? a.n - MOD : a.n; }
mint operator-(mint a, mint b) { return (a.n -= b.n) < 0 ? a.n + MOD : a.n; }
mint operator*(mint a, mint b) { return 1LL * a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }
ostream &operator<<(ostream &os, mint a) { return os << a.n; }
istream &operator>>(istream &is, mint &a) { return is >> a.n; }
mint inv(mint x) {
  long long a = x.n, b = MOD, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    swap((a -= t * b), b);
    swap((u -= t * v), v);
  }
  return mint(u);
}
mint operator^(mint a, long long n) {
  mint r = 1;
  while (n) {
    if (n & 1) r *= a;
    a *= a;
    n >>= 1;
  }
  return r;
}
bool operator<(const mint &a, const mint &b) { return a.n < b.n; }
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (auto &ai : a) cin >> ai;
  mint ans = 0;
  for (int k = 0; k < 60; k++) {
    int cnt = 0;
    for (auto ai : a) cnt += ((ai) >> (k)&1);
    ans += mint(1LL << k) * cnt * (n - cnt);
  }
  cout << ans << endl;
  return 0;
}
