#include <bits/stdc++.h>
using namespace std;
const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<long long>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};
vector<long long> A;
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 b / gcd(a, b) * b; }
const int mod = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < (60); i++) {
    long long x = 0;
    for (int j = 0; j < (n); j++)
      if (a[j] >> i & 1) ++x;
    long long now = x * (n - x) % mod;
    for (int j = 0; j < (i); j++) now = now * 2 % mod;
    cout << "now: " << now << endl;
    ans += now;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
