#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const int MAX = 500000;
const int inf = 1000000007;
const long long mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
long long ans;
long long n, a[300005], bit[61];
int main() {
  cin >> n;
  for (int i = (int)(0); i < (int)(n); ++i) cin >> a[i];
  for (int i = (int)(0); i < (int)(n); ++i) {
    int j = 0;
    while (a[i]) {
      if (a[i] & 1) bit[j]++;
      a[i] /= 2;
      j++;
    }
  }
  long long cnt = 1;
  for (int i = (int)(0); i < (int)(60); ++i) {
    ans = (ans + (((bit[i] * (n - bit[i])) % mod) * cnt) % mod) % mod;
    cnt *= 2;
  }
  cout << ans << endl;
  return 0;
}
