#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
          Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
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) { return a * b / gcd(a, b); }
struct edge {
  int to, cost;
};
long long n;
vector<long long> a;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long s;
    cin >> s;
    a.push_back(s);
  }
  vector<long long> keta(61, 0);
  long long b = 1;
  for (int i = 0; i <= 60; i++) {
    long long sum = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & b) {
        sum++;
      }
    }
    b *= 2;
    keta[i] = sum;
  }
  long long ans = 0;
  b = 1;
  for (int i = 0; i <= 60; i++) {
    ans += b * (keta[i] * (n - keta[i]));
    b *= 2;
    ans %= MOD;
  }
  cout << ans << "\n";
}
