#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long mod = 1e9 + 7;
int f[65];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long a;
    scanf("%lld", &a);
    for (long long j = 0; j < 62; j++)
      if (a & ((long long)1 << j)) f[j]++;
  }
  long long sum = 0;
  for (long long i = 0; i < 62; i++) {
    sum += f[i] * ((((long long)1 << i) % mod) % mod) * (n - f[i]) % mod;
    sum %= mod;
  }
  cout << sum << endl;
  return 0;
}
