#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9 + 7;
int main() {
  cout << fixed << setprecision(10);
  vector<long long> v(70, 0);
  int n;
  cin >> n;
  vector<long long> num(n, 0);
  for (int i = 0; i < (n); i++) cin >> num[i];
  for (int i = 0; i < (62); i++) {
    for (int j = 0; j < (n); j++) {
      if ((num[j] >> i) & 1) {
        v[i]++;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < (62); i++) {
    long long num2 = 0;
    for (long long j = 0; j < v[i] * (n - v[i]); j++) {
      num2 += (1ll << i);
      num2 %= MOD;
    }
    ans += num2;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
