#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const long long mod = 1e9 + 7;
vector<int> g[N];
int T, n, b, c, r;
int x1, x2, ans;
long long a[63][3];
long long x[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < 60; i++) {
    for (int j = 1; j <= n; j++) {
      int t = (x[j] >> i) & 1ll;
      a[i][t]++;
    }
  }
  long long sum = 0;
  for (int i = 0; i < 60; i++) {
    long long t = a[i][0] * a[i][1];
    t %= mod;
    t = t * (1ll << i) % mod;
    sum = sum + t % mod;
  }
  cout << sum % mod;
}
