#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = (int)1e9;
const long long inf = (long long)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long res = 0;
  for (int d = 0; d < 60; d++) {
    long long n0 = 0, n1 = 0;
    for (int i = 0; i < n; i++) {
      if ((a[i] >> d) & 1)
        ++n1;
      else
        ++n0;
    }
    long long n = n0 * n1 % mod;
    long long tmp = (1 << d) % mod;
    tmp = tmp * n % mod;
    res = (res + tmp) % mod;
  }
  std::cout << res << '\n';
  return 0;
}
