#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
struct mint {
  long long n;
  mint(long long n_ = 0) : n(n_) {}
};
mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
mint operator+(mint a, mint b) {
  long long x = a.n + b.n;
  return x - (x >= MOD) * MOD;
}
mint operator-(mint a, mint b) {
  long long x = a.n - b.n;
  return x + (x < 0) * MOD;
}
mint operator*(mint a, mint b) { return (long long)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; }
istream &operator>>(istream &i, mint &a) { return i >> a.n; }
ostream &operator<<(ostream &o, mint a) { return o << a.n; }
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long N;
  cin >> N;
  vector<long long> v(N);
  for (auto &x : v) {
    cin >> x;
  }
  mint res = 0;
  for (long long d = (0), d_len = (60); d < d_len; ++d) {
    long long n0 = 0, n1 = 0;
    for (auto &x : v) {
      if (x >> d & 1) {
        n1++;
      } else {
        n0++;
      }
    }
    mint msk = (1LL << d);
    res += mint(msk) * n0 * n1;
  }
  cout << res << endl;
  return 0;
}
