#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
using ll = long long;
using prique = priority_queue<long long>;
const long long INF = LLONG_MAX / 3;
const long long MAX = 710000;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
struct UnionFind {
  vector<long long> par;
  vector<long long> rank;
  vector<long long> sizeuf;
  UnionFind(long long n = 1) { init(n); }
  void init(long long n = 1) {
    par.resize(n);
    rank.resize(n);
    sizeuf.resize(n);
    for (long long i = 0; i < n; ++i) {
      par[i] = i;
      rank[i] = 0;
      sizeuf[i] = 1;
    }
  }
  long long root(long long x) {
    if (par[x] == x) {
      return x;
    } else {
      long long r = root(par[x]);
      return par[x] = r;
    }
  }
  bool issame(long long x, long long y) { return root(x) == root(y); }
  bool merge(long long x, long long y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (rank[x] < rank[y]) swap(x, y);
    if (rank[x] == rank[y]) ++rank[x];
    par[y] = x;
    sizeuf[x] += sizeuf[y];
    return true;
  }
  long long size(long long x) { return sizeuf[root(x)]; }
};
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long i, long long j) { return i * (j / gcd(i, j)); }
const long long MOD = 1000000007;
signed main() {
  long long n;
  cin >> n;
  long long a[310000];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long cnt[60] = {};
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 60; j++) {
      if (a[i] & ((long long)1 << j)) cnt[j]++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 60; j++) {
      if (a[i] & ((long long)1 << j)) {
        cnt[j]--;
        ans += ((long long)1 << j) * (n - 1 - i - cnt[j]);
      } else {
        ans += ((long long)1 << j) * cnt[j];
      }
      ans %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}
