#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int n, cnt[70];
long long a, ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    for (int j = 0; j < 60; j++) {
      if ((a >> j) & 1) {
        ans += (long long(i - cnt[j])) << j;
      } else {
        ans += (long long(cnt[j])) << j;
      }
      cnt[j] += (a >> j) & 1;
      ans %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}
