#include <bits/stdc++.h>
using namespace std;
long long cnt[65][2] = {0};
long long ans[65] = {0};
const long long mod = 1e9 + 7;
signed main() {
  long long n;
  cin >> n;
  vector<long long> vec;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    vec.push_back(a);
  }
  for (long long i = 0; i < 62; i++) {
    cnt[i][(vec[0] >> i) & 1]++;
  }
  for (long long i = 1; i < n; i++) {
    for (long long j = 0; j < 62; j++) {
      long long b = ((vec[i] >> j) & 1);
      b++;
      b %= 2;
      ans[j] += cnt[j][b];
      b++;
      b %= 2;
      cnt[j][b]++;
    }
  }
  long long res = 0;
  for (long long i = 0; i < 62; i++) {
    long long kans = ((long long)1 << i);
    kans %= mod;
    kans *= ans[i];
    kans %= mod;
    res += kans;
    res %= mod;
  }
  cout << res << endl;
}
