#include <bits/stdc++.h>
using namespace std;
const int maxn = 200009;
const long long MOD = 1e9 + 7;
class {
 public:
  void solve() {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    long long ans = 0, two = 1;
    for (int i = 0; i <= 63; ++i) {
      long long zero = 0, one = 0, count = 0;
      for (int j = 0; j < n; ++j)
        if (a[j] >> i & 1ll)
          one++;
        else
          zero++;
      for (int j = 0; j < n; ++j) {
        if (a[j] >> i & 1ll) {
          one--;
          count += zero;
        } else {
          zero--;
          count += one;
        }
      }
      (ans += two * count % MOD) %= MOD;
      two = two * 2 % MOD;
    }
    cout << ans << '\n';
  }
} NSPACE;
int main() {
  ;
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  NSPACE.solve();
}
