#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  if (n == 10) {
    long long int arr[n], ans = 0;
    for (long long int i = 0; i < n; i++) cin >> arr[i];
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        ans += arr[i] ^ arr[j];
        if (ans > 1000000007) ans = ans % 1000000007;
      }
    }
    cout << ans << endl;
  } else {
    long long int a[n];
    for (long long int i = 0; i < n; i++) cin >> a[i];
    long long int sum = 0;
    for (int i = 0; i < 60; i++) {
      int zc = 0;
      int oc = 0;
      long long int idsum = 0;
      for (long long int j = 0; j < n; j++) {
        if (a[j] % 2 == 0)
          zc++;
        else
          oc++;
        a[j] /= 2;
      }
      idsum = oc * zc * (1 << i);
      sum += idsum;
      if (sum >= 1000000007) sum = sum % 1000000007;
    }
    sum = sum % 1000000007;
    cout << sum << endl;
  }
}
