#include <bits/stdc++.h>
using namespace std;
struct IoSetup {
  IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} IoSetup;
static const signed long long INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed long long SMOD = 1000000007;
static const signed long long NMOD = 998244353;
static const signed long long dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
static const signed long long dy[] = {0, -1, 0, 1, -1, 1, -1, 1};
bool inside(long long x, long long y, long long w, long long h) {
  return (x >= 0 && y >= 0 && x < w && y < h);
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) return (a = b, 1);
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) return (a = b, 1);
  return 0;
}
long long sum[70];
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 61; j++) {
      sum[j] = sum[j] + !!(a[i] & (1LL << j));
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 61; i++)
    ans = (ans + sum[i] * (n - sum[i]) % SMOD * (1LL << i) % SMOD) % SMOD;
  cout << ans << endl;
  return 0;
}
