#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
long long mod = 1000000007, mod2 = 998244353;
void chmin(long long &a, long long b) {
  if (a > b) a = b;
}
void chmax(long long &a, long long b) {
  if (a < b) a = b;
}
const long long INF = 1LL << 60;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
using Edge = pair<int, int>;
using Graph = vector<vector<Edge> >;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int bit = 0; bit < 60; ++bit) {
    long long cnt0 = 0, cnt1 = 0;
    long long tmp = (1LL << bit) % mod;
    for (int i = 0; i < n; ++i) {
      if (a[i] & 1LL << bit)
        cnt1++;
      else
        cnt0++;
    }
    tmp = (tmp * cnt0 * cnt1) % mod;
    ans = (ans + tmp) % mod;
  }
  cout << ans << endl;
  return 0;
}
