#include <bits/stdc++.h>
using namespace std;
void add_me(long long int &a, long long int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
void sub_me(long long int &a, long long int b) {
  a -= b;
  if (a < 0) a += 1000000007;
}
struct disjointset {
  int parent[200001];
  disjointset() {
    for (int i = 1; i < 200001; i++) parent[i] = i;
  }
  int find(int x) {
    int par = parent[x];
    if (par == x) return x;
    return find(parent[x]);
  }
  void union_(int x, int y) {
    int par1 = find(x);
    int par2 = find(y);
    if (par1 == par2) return;
    parent[par2] = par1;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n;
  cin >> n;
  vector<long long int> vec(60, 0);
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    for (int bit = 0; bit < 60; bit++) {
      if (x & (1ll << bit)) vec[bit]++;
    }
  }
  long long int ans = 0;
  long long int pow2 = 1;
  for (int bit = 0; bit < 60; bit++) {
    ans += (((vec[bit]) % 1000000007) * ((n - vec[bit]) % 1000000007) *
            (pow2 % 1000000007)) %
           1000000007;
    pow2 *= 2;
  }
  cout << ans << endl;
  return 0;
}
